
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
strange-router
Advanced tools
A module to aid bringing configurable routes to react-router v4
Lead Maintainer - William Woodruff
See also the API Reference
npm install strange-router
const routes = [
{
path: 'first', // matches '/first'
component: MyComponent,
childRoutes: [
{
path: 'second', // matches '/first/second'
childRoutes: [
{ path: 'third', component: ThirdComponent }, // matches '/first/second/third'
{ redirect: { to: '/404' } } // catch all, redirects to absolute path '/404'
]
},
{ redirect: { from: 'oldPath', to: 'newPath' } } // '/first/oldPath' will redirect to '/first/newPath'
{
path: 'newPath',
component: NewStuff,
onWillMount: ({ route, match, location, history }) => {
fetchSomeData();
},
onDidMount: ({ route, match, location, history }) => {
logSomething();
},
onWillUnmount: ({ route, match, location, history }) => {
cleanup();
},
componentDidCatch: ({ err, info, route, match, location, history }) => {
handleErr(err);
// and / or
history.replace('/onErr', { err, info });
}
},
{ redirect: { to: '/404' } } // catch all, redirects to absolute path '/404'
]
},
{
path: '404',
component: FourOFour
},
{
path: 'onErr',
component: UhOhError
}
];
const React = require('react');
const { Provider } = require('react-redux');
const { ConnectedRouter } = require('react-router-redux');
const StrangeRouter = require('strange-router');
class App extends React.PureComponent {
static propTypes = {
history: T.object.isRequired,
routes: T.array.isRequired,
store: T.object.isRequired
}
render() {
const { history, routes, store } = this.props;
return (
<Provider store={store}>
<ConnectedRouter history={history}>
<StrangeRouter.Routes routes={routes} />
</ConnectedRouter>
</Provider>
);
}
};
FAQs
A module to aid bringing configurable routes to react-router v4.x
The npm package strange-router receives a total of 139 weekly downloads. As such, strange-router popularity was classified as not popular.
We found that strange-router demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.