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

react-router-flux

v1.0.0

Published

Powerful extension for react-router to declare routes.

Readme

Powerful extension for react-router to declare routes.

Installation

Using npm:

$ npm install --save react-router-flux

And then you can import components as follows:

// using an ES6 transpiler, like babel
import { Dispatcher, View, Action, Input } from 'react-router-flux';


// not using an ES6 transpiler
var Dispatcher = require('react-router-flux').Dispatcher;
var View = require('react-router-flux').View;
var Action = require('react-router-flux').Action;
var Input = require('react-router-flux').Input;

Declare route dispatcher

<Dispatcher component={ReactClass}/>

Props

| Property | Type | Required | Description | |:---------|:-------------|:---------|:------------------| |component | ReactClass | yes | A React component |

Declare view-state

The declaration can define in Dispatcher inside only

<View path={String}/> 

Props

| Property | Type | Required | Description | |:---------|:--------|:---------|:--------------------| |path | String| yes | Route path |

Declare inbound parameter into view-state

The declaration can define in a View inside and in a Dispatcher too, but as default value and can be overridden.

<Input name={String} value={Any}/>

Props

| Property | Type | Required | Description | |:---------|:--------|:---------|:--------------------| |name | String| yes | Input property name | |value | Any | no | Input property value|

Note: If the value define as Function you can access to route variables 'params', 'query' and 'state', see below example.

Declare transition

The declaration can define in Dispatcher inside only

<Action on={String} to={String} query={Function|Object} 
                                state={Function|Object} 
                                params={Function|Object}/>

Props

| Property | Type | Required | Description | |:---------|:-----------------------|:---------|:-----------------------------------------| |on | String | yes | Event ID of the component | |to | String | yes | Redirect Route path | |query | Function or Object | no | Define query params for the Route path | |state | Function or Object | no | Define route state for the Router | |params | Function or Object | no | Define params for the Route path |

How Does It Use?

class TodoMVC extends React.Component {
  render() {
    let {
      filter, /** filter parameter **/
      onFilter, /** to go to /todomvc/active when onFilter({filter: 'active'}) **/
      onFilterNotFound  /** to go to /error/404 **/
    } = this.props;
    //...
  }
};

//store filter variable as path parameter
//  `/todomvc`        ->   <TodoMVC filter="all"/>
//  `/todomvc/active` ->   <TodoMVC filter="active"/>
const mapping_v1 = (
  <Router>
    <Dispatcher component={TodoMVC}>
      {/*as default value*/}
      <Input name="filter" value="all"/>
      
      <View path="/todomvc(/:filter)">
        <Input name="filter" value={({params, query, state}) => params.filter}/>
      </View>
    
      <Action on="filter" to="/todomvc(/:filter)"
              params={({filter}) => { return {filter} }}/>
      <Action on="filterNotFound" to="/error/404"/>
    </Dispatcher>
  </Router>
);

//store filter variable as path parameter v_2
//  `/todomvc`        ->   <TodoMVC filter="all"/>
//  `/todomvc/active` ->   <TodoMVC filter="active"/>
const mapping_v2 = (
  <Router>
    <Dispatcher component={TodoMVC}>
      <View path="/todomvc">
        <Input name="filter" value="all"/>
      </View>
      
      <View path="/todomvc/active">
        <Input name="filter" value="active"/>
      </View>
      
      <View path="/todomvc/completed">
        <Input name="filter" value="completed"/>
      </View>
    
      <Action on="filter" to="/todomvc(/:filter)"
              params={({filter}) => { return {filter} }}/>
    </Dispatcher>
  </Router>
);


//store filter variable as query parameter
//  `/todomvc`               ->   <TodoMVC filter="all"/>
//  `/todomvc?filter=active` ->   <TodoMVC filter="active"/>
const mapping_v3 = (
  <Router>
    <Dispatcher component={TodoMVC}>
      {/*as default value*/}
      <Input name="filter" value="all"/>
      
      <View path="/todomvc">
        <Input name="filter" value={({params, query, state}) => query.filter}/>
      </View>
  
      <Action on="filter" to="/todomvc"
              query={({filter}) => { return {filter} }}/>
      <Action on="filterNotFound" to="/error/404"/>
    </Dispatcher>
  </Router>
);

License

MIT, © 2017 Dmitry Divin.