4

I'm attempting to use React Helmet async to change the title and meta tag of a React app's client-side rendering at runtime. I can change the title, but not the meta tag.

My code on index.html is

 <title>my title</title>
<meta
  name="description"
  content="test description"
/>

My code on one of the pages

<Helmet>
<title>{title}</title>
<meta name='description' content={description} />
</Helmet>

I wrap app.js with helmet provider as

 <HelmetProvider>
   <App/>
 </HelmetProvider>

Please help me to fix this issue, or you can suggest other methods or packages to update the meta description. I am using React and React-dom version 17.0.2.

1 Answers1

1

Write data-rh="true" in meta tag inside index.html e.g,

<meta name="description" content="test description" data-rh="true" />

and then inspect HTML to see changes.

Ali Raza
  • 21
  • 4
  • couldn't find any documentation for this except for a [github issue](https://github.com/staylor/react-helmet-async/issues/108) – Akber Iqbal Feb 22 '23 at 22:45