0.0.4 • Published 6 years ago

react-router-config-name v0.0.4

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

react-router-config-name

a simple module for react-router4 what can get router message by using the name property

install

npm install --save react-router-config-name

usage

  1. define your router array.
    let routers = [
       {
         path: '/app',
         component: App,
         name: 'app',
       }
    ];
  1. init the routers message.
    import { setRouters } from 'react-router-config-name';
    setRouters(routers);
  1. get router message whar you need by use the name property.
    import { getRouteByName } from 'react-router-config-name';
    const AppRoute = getRouteByName('app');
  1. use route in <Route/> tag.
  import { Route } from 'react-router-dom';
  ...
  <Route
    key={AppRoute.path}
    path={AppRoute.path}
    component={AppRoute.component}
  />
0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago