UNPKG

router-add-query

Version:
52 lines (35 loc) 1.26 kB
# router-add-query [WIP] [![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master)](https://travis-ci.org/joemccann/dillinger) 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 ```sh $ yarn install react-router-query-params ``` ### Usage For production environments... ```sh import { withRouterWithQuery } from 'react-router-query-params'; const App = () => <div> Example Component </div> withRouterWithQuery(App); // OR <RouterWithQuery> <App/> <RouterWithQuery/> ``` ### Development Want to contribute? Great!