This is an example of using react-helmet with React and react-router in a universal (client/server) context.
Check out this repo (or simply copy the code) and then, from inside the codebase, follow these steps:
- Install requirements:
$ npm install
- Run
webpack
to create the client-side script
$ webpack
- Start the Express server
$ npm start
- Visit http://localhost:8080 and check out
the document's
<head>
node in its source. Then, change pages and watch asreact-helmet
keeps<head>
in sync with the current route.