
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-routing
Advanced tools
For more information visit www.kriasoft.com/react-routing
$ npm install react-routing --save
import React from 'react';
import ReactDOM from 'react-dom';
import Router from 'react-routing/lib/Router';
import NotFoundPage from './components/NotFoundPage';
import ErrorPage from './components/ErrorPage';
const router = new Router(on => {
on('*', async (state, next) => {
const Layout = require('./components/Layout');
const component = await next();
if (component === undefined) {
return undefined;
}
return <Layout context={state.context}>{component}</Layout>;
});
on('/', () => {
const HomePage = require('./components/HomePage');
return <HomePage />;
});
on('/products', async () => {
const [data, require] = await Promise.all([
http.get('/api/products'),
new Promise(resolve => require.ensure(['./components/ProductsPage'], resolve))
]);
const ProductsPage = require('./components/ProductsPage');
return data ? <ProductsPage products={data} /> : undefined;
});
on('/products/:name', async (state) => {
const [data, require] = await Promise.all([
http.get(`/api/products/${state.params.name}`),
new Promise(resolve => require.ensure(['./components/ProductInfoPage'], resolve))
]);
const ProductInfoPage = require('./components/ProductInfoPage');
return data ? <ProductInfoPage product={data} /> : undefined;
});
on('error', (state, error) => state.statusCode === 404 ?
<Layout context={state.context} error={error}><NotFoundPage /></Layout> :
<Layout context={state.context} error={error}><ErrorPage /></Layout>
);
});
await router.dispatch({ path: '/products/example' }, (state, component) => {
ReactDOM.render(component, document.getElementById('app'));
});
The MIT License © Konstantin Tarkus (@koistya)
FAQs
Isomorphic router for React.js applications
The npm package react-routing receives a total of 39 weekly downloads. As such, react-routing popularity was classified as not popular.
We found that react-routing demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.