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

redux-regexp-router

v0.4.1

Published

RegExp based router

Readme

Redux Regexp Router npm version npm downloads

Declarative routing for React Redux using RegExps as patterns.

  • Nested routing
  • Relative links
  • Regexp patterns

Installation

npm install --save redux-regexp-router

How to use

  1. Add routeReducers to your Store
  2. Wrap your app to History component
  3. Use Route's
import ReactDom from 'react-dom';
import { combineReducers, createStore } from 'redux';

import { routeReducers, createHistory, HashHistory } from 'redux-regexp-router';

let store = createStore(combineReducers({ ...routeReducers, yourAppReducers }));
ReactDom.render(
    <Provider store={store}>
        <HashHistory>
            <div>
                <ul>
                    <li><Link to="/link1">To Link1</Link></li>
                    <li><Link to="/link2">To Link2</Link></li>
                    <li><Link to="/link3">To Link3</Link></li>
                </ul>
                
                <h4>Result</h4>
                <Route path="^link1">
                    <div>Link1</div>
                </Route>
                <Route path="^link2">
                    <div>Link2</div>
                </Route>
                <Route path="^link3">
                    <div>Link2</div>
                </Route>
            </div>
        </HashHistory>
    </Provider>
    , document.getElementById('app'));

Nested Routes

Just put one Route to another.

...
    <ul>
        <li><Link to="/link1">To Link1</Link></li>
        <li><Link to="/link1/1">To Link1 / 1</Link></li>
        <li><Link to="/link2">To Link2</Link></li>
    </ul>
    
    <h4>Result</h4>
    <Route path="^link1">
        <div>Link1</div>
        <Route path="^1">
            <div>SubRoute</div>
        </Route>
    </Route>
    <Route path="^link2">
        <div>Link2</div>
    </Route>
...

Switch routing

You can place many routes in one section. First matched route will display.

...
    <Switch>
        <Route path="^path123/"><span>path123</span></Route>
        <Route path="^path12/"><span>path12</span></Route>
        <Route path="^path1/"><span>path12</span></Route>
        <Route><span>not found</span></Route>
    </Switch>
...

Relative links

You can pass relative link to Link component. This link have an adress based on Route location.

...
    <Route path="^about/">
        <Link to="company">Company</Link>
    </Route>
...

Link will have an address: /about/company. To absolute link just add / at first.

Patterns / Path

Path matching based on RegExp. Also you can set kwargs for your routes.

    <Route path="^products/(id=\d+)/$" component={<Product/>}/>
    <Route path="^products/(slug=\w+)/$" component={<Product/>}/>
    <Route path="^products/(category=\w+)/(id=\d+)/$" component={<Product/>}/>
  • ^products/(id=\d+)/$ - id kwarg with digits
  • ^products/(slug=\w+)/$ - slug kwarg with [0-9a-z_]
  • ^products/(category=\w+)/(id=\d+)/$ - creates category and id kwargs

Access to Kwargs

By Props

Child component of Route will have this.props.kwargs

By Store

Connect your component to reducer routeKwargs. RouteKwargs contain kwargs by Routes. Key is a concatenate of nested routes path or name .

<Route path="^link1/(id=\d+)" name="link1">
    <div>Link1</div>
    <Route path="^(id=\d+)" name="sublink">
        <div>SubRoute</div>
    </Route>
</Route>

routeKwargs state by url /link1/1/2/:

{
  "link1": {
    "id": "1"
  },
  "link1/sublink": {
    "id": "2"
  }
}

By Context

Use helper addRoutingContext to add Context. After this you can get kwargs based on current route of your component. To get kwargs use: this.context.getRouteKwargs()

Absolute Routes

If you need, you can create Route ignoring parent location, just add absolute prop. url: /test/nested/test

    <Route path="^test/">
        <Route path="^nested">Will show</Route>
        <Route path="^test/nes" absolute>Will Show too, becouse absolute</Route>
    </Route>