To fully control document.title in your React app.
document.title
only when all react-titled instances are reconciledyarn add react react-dom react-titled
import { Titled } from 'react-titled';
<Titled title={'Example.com'}>
<h1>Welcome!</h1>
<Titled title={title => `Homepage | ${title}`} />
</Titled>;
outputs
Homepage | Example.com
import { Titled } from 'react-titled';
<Titled title={() => 'Example.com'}>
<Titled title={() => 'Homepage'} />
</Titled>;
outputs
Homepage
import { Titled } from 'react-titled';
<Titled title={() => 'Example.com'} onChange={title => console.log(title)}>
<h1>Welcome!</h1>
<Titled title={title => `Homepage | ${title}`} />
</Titled>;
git clone https://github.com/tajo/react-titled
cd react-titled
yarn install
yarn build:examples
open examples/index.html
git clone https://github.com/tajo/react-titled
cd react-titled
yarn install
yarn build:examples --watch
open examples/index.html
yarn test