2.0.0 • Published 3 years ago
routes-with-title v2.0.0
routes-with-title
Installation
Using npm:
$ npm install routes-with-title
Then with a module bundler like webpack, use as you would anything else:
// using ES6 modules
import { Route, useTitle } from "routes-with-title";
// using CommonJS modules
const Route = require("routes-with-title").Route;
const { titleData, setTitle, setType, setDelay }
= require("routes-with-title").useTitle({
title: 'Initial Title',
type: 'writing',
delay: 750
});
Example
You can use the Route
component as follows:
// No title settings:
<Route exact path="/your-path">...</Route>
// With static title:
<Route title="This is a static title" exact path="/your-path">...</Route>
// With dynamic title:
<Route title="This is a title {dynamic}" exact path="/your-path/:dynamic">...</Route>
You can use the useTitle
hook as follows:
Code | Result |
---|---|
Issues
If you find a bug, please file an issue on our issue tracker on GitHub.