react-config-router

0.0.2 • Public • Published

react-config-router

A configuration router base on react-router v4

NPM JavaScript Style Guide

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

Readme

Keywords

none

Package Sidebar

Install

npm i react-config-router

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

219 kB

Total Files

6

Last publish

Collaborators

  • zenghongtu