I was working on a single page application in react.js, so what is the best way to update meta tags on page transitions or browser back/forward?
React isn't an MVC framework. React is a library for building composable user interfaces. While this is true, the term MVC framework is more of a marketing term. The original MVC concept is closer to a design pattern and has nothing to do with frameworks.
I've used react-document-meta in an older project.
Just define your meta values
const meta = { title: 'Some Meta Title', description: 'I am a description, and I can create multiple tags', canonical: 'http://example.com/path/to/page', meta: { charset: 'utf-8', name: { keywords: 'react,meta,document,html,tags' } }
and place a
<DocumentMeta {...meta} />
in the return
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With