npm.io
0.0.9 • Published 8 years ago

router-add-query

Licence
MIT
Version
0.0.9
Deps
4
Size
6 kB
Vulns
0
Weekly
0

router-add-query

[WIP]

Build Status

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!

Keywords