2.0.0 • Published 3 years ago

routes-with-title v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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:

CodeResult
Example 1Result 1
Example 2Result 2
Example 1Result 3

Issues

If you find a bug, please file an issue on our issue tracker on GitHub.

2.0.0

3 years ago

1.2.0-beta.1

3 years ago

1.2.0-beta.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago