score:1

Accepted answer

you can get the routes in an array by using below library

https://github.com/alansouzati/react-router-to-array

import react from 'react';
import { route, indexroute } from 'react-router';
import reactroutertoarray from 'react-router-to-array';
// or var reactroutertoarray = require('react-router-to-array');

console.log(reactroutertoarray(
<route path="/" component={fakecomponent}>
{/* just to test comments */}
<indexroute component={fakecomponent} />
<route path="about" component={fakecomponent}>
  <route path="home" component={fakecomponent} />
  <route path="/home/:userid" component={fakecomponent} />
</route>
<route path="users" component={fakecomponent} />
<route path="*" component={fakecomponent} />
</route>)
); //outputs: ['/', '/about', '/about/home', '/users']

Related Query

More Query from same tag