router-add-query
v0.0.9
Published
React router with query params
Downloads
14
Readme
router-add-query
[WIP]
This library will allow you to add query params to react router v4.0.0 and above.
- Add an object to the location props of any component with the most recent queryParams of each page visited :
{
query:
{ "/": {utm_source: "facebook"},
{ "signup/": {utm_campaign: "Dillinger", utm_source: "facebook"}}
}
- Lightweight
- Use indexdb to store the state of the queryParams
Tech
It uses a number of open source projects to work properly:
- [Ramda] - A practical functional library for JavaScript programmers.
- [idb-keyval] - A super-simple-small promise-based keyval store implemented with IndexedDB
And of course React-router-query-params itself is open source with a [MIT License][dill] on GitHub.
Installation
$ yarn install react-router-query-params
Usage
For production environments...
import { withRouterWithQuery } from 'react-router-query-params';
const App = () => <div> Example Component </div>
withRouterWithQuery(App);
// OR
<RouterWithQuery> <App/> <RouterWithQuery/>
Development
Want to contribute? Great!