/redux-arena-router

High order components of react-router based on redux-arena

Primary LanguageJavaScriptApache License 2.0Apache-2.0

redux-arena-router-router

Build Status Coverage Status npm version PRs Welcome

High order components of react-router based on redux-arena-router

Install

npm install redux-arena-router --save

Example

A complete example is under /example directory, including a lot of HOC. And add redux-devtools for state changing show. Online example can be found here: Here

Quick Start

  1. Export ArenaScene high order component for ArenaRoute using.
import { bundleToComponent } from "redux-arena/tools";
import state from "./state";
import saga from "./saga";
import * as actions from "./actions";
import PageA from "./PageA";

export default bundleToComponent({
  Component: PageA,
  state,
  saga,
  actions
})
  1. Pass the ArenaScene high order component as ArenaRoute's children.
import React from "react";
import { BrowserRouter, Switch } from "react-router";
import { ArenaRoute } from "redux-arena-router";
import PageA from "./pageA";

export default (props) =>
    (<BrowserRouter>
        <Switch>
            <ArenaRoute>
                <PageA />
            </ArenaRoute>
        </Switch>
    </BrowserRouter>);