javascript - React show routes if set up using react-router -


is there command on console can execute @ run-time tell me routes? have used react-router, routes don't work. in rails can list @ runtime.

you can routes in array using below library

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

import react 'react'; import { route, indexroute } 'react-router'; import reactroutertoarray 'react-router-to-array'; // or var reactroutertoarray = require('react-router-to-array');  console.log(reactroutertoarray( <route path="/" component={fakecomponent}> {/* 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'] 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -