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?
You can use react-meta-tags. It allows you to write title and other meta tags in a declarative way and in normal jsx format, which will be moved to head (Check server usage on the doc).
import React from 'react';
import MetaTags from 'react-meta-tags';
class Component1 extends React.Component {
render() {
return (
Page 1
Some Content
)
}
}
You may also like to check react-helmet if you have an advanced use case.