npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@loan_market/react-router-redux-multi

v5.3.0

Published

Redux bindings for React Router

Readme

react-router-redux-multi

build status

Keep your state in sync with your multiple routers :sparkles::sparkles::sparkles::sparkles:

This is a fork of react-router-redux. It retains the same simple API as react-router-redux v5 but adds additional support for using multiple routers.

Use this as a drop-in replacement for react-router-redux when you have multiple routers that you want to sync with your redux store.

Why fork?

React Router Redux does not allow you to sync multiple routers to your redux store. See this issue: https://github.com/ReactTraining/react-router/issues/5663. This is understandable if you only have a single global router that is linked to your URL history. However, we believe that routers should be more extensible and generic than that. You may also want to use routing logic elsewhere to present components which you do not explicitly want stored in your browser's url history. We initially developed this fork as a pull request to generate conversation around the best approaches to implementing support for multiple routers. However, React Redux Router are not willing to support multiple routers, so we have now published this for anyone else who encounters this use case.

Installation

npm install --save react-router-redux-multi
npm install --save history

API

props

  • store (Redux Store): The single Redux store in your application.
  • children (ReactElement): The root of your routes.
  • history (History): The history instance who's location maps to routes
  • namespace (string): The namespace for to identify the history instance (default: 'default')

routerMiddleware(history, [namespace])

Redux middle to intercept history actions and update the location in the reducer. Takes history instance as first argument, and optional namespace string to specify which history object to intercept.

Usage:

const middleeare =
const store = createStore(
  combineReducers({
    ...reducers,
    router: routerReducer
  }),
  applyMiddleware(middleware)
)

routerReducer

The redux reducer for storing router locations. Can store any number of history locations.

State is of the form:

{
  location: {
    default: history.location,
    [namespace]: history.location
  }
}

Usage:

import ConnectedRouter from '../ConnectedRouter'
import { routerReducer } from '../reducer'

store = createStore(combineReducers({
  router: routerReducer
}))

History Actions

This library exposes all History instances navigation methods (push, replace, go, goBack, goForward) as dispatchable redux actions. For detailed description of these methods look at the History documentation.

You can also create actions which target a specific history object by using the namespaced variants.

  • namespacedPush(namespace)(path, [state])
  • namespacedReplace(namespace)(path, [state])
  • namespacedGo(namespace)(n)
  • namespacedGoBack(namespace)()
  • namespacedGoForward(namespace)()

These actions will trigger state changes only on the history identified by that namespace. The same namespace should be passed to actions, as is passed to ConnectedRouter and routerMiddleware.

Or you can create an object with all namespaced actions via namespacedRouterActions(namespace).

Usage:

import { push, namespacedPush } from 'react-router-redux'

// Using store directly:
// to target the default router
store.dispatch(push('/foo'))

// or to target another reducer use namespaced actions
pushMemory = namespacedPush('memory')
store.dispatch(pushMemory('/foo'))

// Or via Connect
connect(
  () => {}, // mapStateToProps
  dispatch =>
  bindActionCreators({
    push: push,
    pushToMemory: namespacedPush('/foo'),
  }, dispatch);
)

Example Usage

Here's a basic idea of how it works:

import React from 'react'
import ReactDOM from 'react-dom'

import { createStore, combineReducers, applyMiddleware } from 'redux'
import { Provider } from 'react-redux'

import createHistory from 'history/createBrowserHistory'
import { Route } from 'react-router'

import { ConnectedRouter, routerReducer, routerMiddleware, push } from 'react-router-redux'

import reducers from './reducers' // Or wherever you keep your reducers

// Create a history of your choosing (we're using a browser history in this case)
const history = createHistory()
const memoryhistory = createMemoryHistory()
const memoryNamespace = 'memory'

// Build the middleware for intercepting and dispatching navigation actions
const middleware = [
  routerMiddleware(history),
  routerMiddleware(memoryhistory, memoryNamespace)
]

// Add the reducer to your store on the `router` key
// Also apply our middleware for navigating
const store = createStore(
  combineReducers({
    ...reducers,
    router: routerReducer
  }),
  applyMiddleware(middleware)
)

ReactDOM.render(
  <Provider store={store}>
    { /* ConnectedRouter will use the store from Provider automatically */ }
    { /* This router is linked to your URL history */ }
    <ConnectedRouter history={history}>
      <div>
        <Route exact path="/" component={Home}/>
        <Route path="/about" component={About}/>
        <Route path="/topics" component={Topics}/>
      </div>
    </ConnectedRouter>
    { /* This router is stored in memory */ }
    <ConnectedRouter history={memoryHistory} namespace={memoryNamespace}>
      <div>
        <Route path="/animationB" component={AnimationA}/>
        <Route path="/animationA" component={AnimationB}/>
      </div>
    </ConnectedRouter>
  </Provider>,
  document.getElementById('root')
)