1.0.0 • Published 3 years ago
route-with-title v1.0.0
route-with-title
Installation
Using npm:
$ npm install --save route-with-title
Then with a module bundler like webpack, use as you would anything else:
// using ES6 modules
import { Route } from "route-with-title";
// using CommonJS modules
const Route = require("route-with-title").Route;
Example
You can use theRoute
component as follows:
// With static title:
<Route title="Your Title" exact path="/your-page">
<YourPageComponent/>
</Route>
// With dynamic title:
<Route title="Your Title {your_param}" exact path="/your-page/:your_param">
<YourPageComponent/>
</Route>
You can use theuseTitle
hook as follows:
const YourPageComponent = () => {
useTitle("Your Page Title");
return (
<div>
...
</div>
);
}
Issues
If you find a bug, please file an issue on our issue tracker on GitHub.