react-router-config-name
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

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}
  />

Readme

Keywords

Package Sidebar

Install

npm i react-router-config-name

Weekly Downloads

5

Version

0.0.4

License

ISC

Last publish

Collaborators

  • senasiko