Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
hookrouter-react
Advanced tools
NOTE: This is a patched version from the original hookrouter package.
This package does the following:
The modern alternative to react-router.
Tested from React 16.8.1
upwards.
Well, this is straightforward:
npm i hookrouter-react
Detailed documentation about how to use hookrouter can be found here
import {useRoutes} from 'hook-router';
const routes = {
'/': () => <HomePage />,
'/about': () => <AboutPage />,
'/products': () => <ProductOverview />,
'/products/:id': ({id}) => <ProductDetails id={id} />
};
const MyApp = () => {
const routeResult = useRoutes(routes);
return routeResult || <NotFoundPage />;
}
Routes are defined as an object. Keys are the routes, which are matched
against the URL, the values need to be functions that are called when a route
matches. You may define placeholders in your routes with :something
which
will be forwarded as props to your function calls so you can distribute them
to your components.
The hook will return whatever the route function returned, so you may also return strings, arrays, React fragments, null - whatever you like.
FAQs
A hook based router for React
The npm package hookrouter-react receives a total of 8 weekly downloads. As such, hookrouter-react popularity was classified as not popular.
We found that hookrouter-react 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.