A
A
AndreyKawilov2021-10-11 15:43:27
React
AndreyKawilov, 2021-10-11 15:43:27

Working with meta in react: how to change the meta dynamically?

Using https://www.npmjs.com/package/react-helmet
We have a Node JS based SPA using react

Using the react-helmet module we can control the meta like this:

<Helmet>
    <title>My Title</title>
    <meta name="description" content="Helmet application" />
</Helmet>

And it works great! But...
As far as I know, React compiles everything into js files that subsequently render the page, but in this way meta tags do not work because the page is not simply rendered by url, in order for these meta tags to appear on the page, it must be opened by someone.

And here is the question itself: how can you work with meta tags so that they work correctly (and not that the user would have to go to the page and only then they would be loaded

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question