3.1.0 • Published 5 years ago

react-router-query-middleware v3.1.0

Weekly downloads
59
License
-
Repository
github
Last release
5 years ago

react-router-query-middleware

Download Count npm version

:white_check_mark: A solution for this

:palm_tree: It adds query object into router reducer when using: React Router v4 :heavy_plus_sign: connected-react-router

Installation

$ npm install --save react-router-query-middleware

Simple usage

Add the middleware after the routerMiddleware provided from connected-react-router

...
import { routerMiddleware } from 'connected-react-router';
import queryMiddleware from 'react-router-query-middleware';
...
  const middlewares = [
    ...
    thunk, 
    routerMiddleware(history),
    queryMiddleware({}),
    ...
    // Add other middlewares here
  ];
  
applyMiddleware(...middlewares);
...

Advanced usage

You can configure the action name that triggers location change or the path of location object in triggered action

...
queryMiddleware({
  actionName: '@@router/LOCATION_CHANGE',
  actionLocationPath: 'payload.location'
});
...

Options

optdefaulttypedescription
actionName@@router/LOCATION_CHANGEstringAction name that triggers location change
actionLocationPathpayload.locationstringPath of location object in triggered action

License

MIT

3.1.0

5 years ago

3.0.6

5 years ago

3.0.5

5 years ago

3.0.4

5 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago