react-config-router
v0.0.2
Published
A configuration router base on react-router v4
Downloads
5
Readme
react-config-router
A configuration router base on react-router v4
Install
npm install --save react-config-router
Usage
import React from 'react'
import ReactDOM from 'react-dom'
import createRouter from 'react-config-router'
const routes = [
{
path: '/user',
component: UserLayout,
routes: [
{path: '/user', redirect: '/user/login', exact: true},
{
path: '/user/login',
component: Login
},
{
path: '/user/:name',
component: User
}
]
},
]
const historyOpts = {
basename: '/react-config-router'
}
ReactDOM.render(createRouter(routes, {historyOpts}), document.getElementById('root'))
use history
anywhere (including with Redux)
import {history} from 'react-config-router'
history.replace('/')
License
MIT © zenghongtu