react-router-path-list

1.1.0 • Public • Published

react-router-path-list

A (potentially naive) way to get an array of paths from a react-router path definition.

Usage

Install it: npm i --save react-router-path-list.

Then use it:

import pathList from 'react-router-path-list';
 
const paths = pathList(
  <Route path="/">
    <IndexRoute>
    <Route path="hello">
      <Route path="world"/>
    </Route>
  </Route>
);
// components removed for brevity

paths will be equal to:

[
  '/',
  '/hello',
  '/hello/world'
]

Why

Probsbly lots of things, but I need it to generate a list of paths for use with a react static site generator.

Contributing

Ideas, comments, and pull requests welcome.

Readme

Keywords

none

Package Sidebar

Install

npm i react-router-path-list

Weekly Downloads

2

Version

1.1.0

License

MIT

Last publish

Collaborators

  • iest