0.0.2 • Published 5 years ago

react-config-router v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

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

0.0.2

5 years ago

0.0.1

5 years ago

0.1.0

5 years ago

1.0.0

5 years ago