Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
bare-routes
Advanced tools
A bare-bones React client-side page router that delegates the actual routing and page loading to user code and only handles history manipulation
bare-routes
is a bare-bones client-side router for React applications. For utmost flexibility, it doesn't provide any means for matching routes, dynamically importing modules, or fetching data. You do all that in your render
callback. bare-routes
only handles the history API and the scroll position.
The heart of bare-routes
is the Router
component. It has one required prop, render
which is a callback that takes an object argument that contains a property names url
, a built-in URL
object, and does whatever is necessary for your application to render the new view. Typically it consists of inspecting url.pathname
to locate the view module, fetch the required data to render the view component, and render it. render
can return either a ReactNode
or -more usefully- a promise that resolves to one. Here's a very simple example:
const App = () => (
<Router
render={async ({ url }) => {
try {
const moduleName = findModuleNameForUrl(url);
const viewModule = await import(`./view/${moduleName}`);
const ViewComponent = viewModule.default;
return <ViewComponent />;
} catch (error) {
return <p>Could not load view: {error.message}</p>;
}
}}
>
Loading...
</Router>
);
function findModuleNameForUrl(url) {
// Locate view module for this URL
}
FAQs
A bare-bones React client-side page router that delegates the actual routing and page loading to user code and only handles history manipulation
We found that bare-routes 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.