useSetMetaOgDescription.js

import { useEffect } from 'react';

export default function useSetMetaOgDescription(params) {
  const { content = '', dependencies = [] } = params;

  useEffect(() => {
    document.head.querySelector('meta[property="og:description"]').setAttribute('content', content);
    document.head.querySelector('meta[name="description"]').setAttribute('content', content);
  }, dependencies);
}