Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
itsy-bitsy-router
Advanced tools
Itsy bitsy router is a very opiniated solution for routing in react applications. It is not compatible with IE and never will be.
You know the drill.
yarn add itsy-bitsy-router
You will need to declare a router before anything else with useRoutes()
.
const Router = useRoutes(
[
{ path: "/login", element: <Login /> },
{ path: "/user/:id", element: <User /> },
],
<FourOhFour />
);
return <Router />;
You can optionally pass a render
prop to the router. It is used when your app
wants a default layout component, giving the route children as the children
prop.
To navigate inside your app using anchor links, there is still the need for a
<Link>
component,
return (
<Link to="/user/synecdokey" state={{ from: "page1" }}>
My profile
</Link>
);
Since the browser history API provides no way to listen to history.pushState()
nor history.replaceState()
at the moment, you will need useNavigate()
to
handle navigation.
const Button = () => {
const navigate = useNavigate();
return <button onClick={() => navigate("/this-url")}>Click me</button>;
};
To navigate programatically, you can use history.back()
and
history.forward()
. They will work as expected, without the need for some
useHistory()
shenanigans.
useParams()
is used for the parameters you provided in the url.
const { id } = useParams();
To access the route state, it's all in history.state
.
A useLocation()
hook is provided, it will give you every property of the
window.location
object.
const { pathname, search } = useLocation();
FAQs
Small and opinionated routing solution for React
The npm package itsy-bitsy-router receives a total of 5 weekly downloads. As such, itsy-bitsy-router popularity was classified as not popular.
We found that itsy-bitsy-router 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.