{"repo":"sindresorhus/react-router-util","free":true,"listed":false,"github":"https://github.com/sindresorhus/react-router-util","clone":"git clone https://github.com/sindresorhus/react-router-util.git","description":"Useful components and utilities for working with React Router","language":"TypeScript","stars":323,"topics":["react-router","react","router","utilities","npm-package","react-component"],"license":"MIT","category":"ui-components","readme_excerpt":"react-router-util Useful components and utilities for working with React Router Install Usage API history A history singleton that you can use in to access the history from outside the router. Can be useful for programmatically navigating to a route when used in combination with non-React code, like Electron IPC events, etc. and Same as the official and , but with history={history} set to the above history singleton, so you can just import the singleton to access the router history object from outside the router. This behavior can be overridden with . Unrendered React component that prints the props of the current route component to the console when not in production. React component that renders the pathname of the current route. For example: /dashboard . Like , but passes additional props to the given component . The following props are passed to the route: path , component , exact , strict , location , sensitive , while the rest are passed to the component . Before: After: An authenticated version of . You pass it an isAuthenticated prop with a boolean of whether it's authenticated. If it's true , it will render the given component or redirect to the given redirectTo path. If it's false , it will redirect to /login or loginPath if specified. You can specify redirectFromLoginTo to have it redirect somewhere from the loginPath when authenticated. It accepts all the props accepts except for render . Additional props are passed to the component . You can also pass it children.","default_branch":null,"files":null,"tree":[],"storefront":"/r/sindresorhus","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/sindresorhus/react-router-util/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}