
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
@graywolfai/react-tiniest-router
Advanced tools
For the times when you *really* need a simple router. Based on [mobx-router](https://github.com/kitze/mobx-router) and [rttr](https://github.com/kitze/rttr).
For the times when you really need a simple router.
Based on mobx-router and rttr.
const routes = {
home: {
id: 'home',
path: '/',
},
about: {
id: 'about',
path: '/about',
},
gallery: {
id: 'gallery',
path: '/gallery/:imageId',
},
}
<Router routes={routes}>
<App />
</Router>
useRouter
goTo
function for navigating to a routeisRoute
function for checking if a route is currently activeconst Root = () => {
const {goTo, isRoute} = useRouter();
return (
<div>
<div>
<button onClick={() => goTo(routes.home)}>go home</button>
<button onClick={() => goTo(routes.about)}>go to about</button>
<button onClick={() => goTo(routes.gallery, { imageId: 1 })}>
go to picture 1
</button>
<button onClick={() => goTo(routes.gallery, { imageId: 2 })}>
go to picture 2
</button>
<button onClick={() => goTo(routes.gallery, { imageId: 3 })}>
go to picture 3
</button>
</div>
<br/>
{isRoute(routes.home) && <div>Welcome home</div>}
{isRoute(routes.about) && <div>About us</div>}
{isRoute(routes.gallery) && <Gallery />}
</div>
);
};
params
, queryParams
, routeId
, path
in the router object.const Gallery = () => {
const { params } = useRouter();
return <div>Browsing picture {params.imageId}</div>;
};
const routes = {
zeroOrMore: {
id: 'zeroOrMore',
// Matches "/", "/hi" and "/hi/ciao"
path: '/:foo*',
},
oneOrMore: {
id: 'oneOrMore',
// Matches "/hola" and "/hola/hallo" but not "/"
path: '/:bar+',
},
optional: {
id: 'optional',
// Matches "/" or "/bonjour"
path: '/:bar?',
},
emptyString: {
id: 'emptyString',
// qux matches an empty string meaning "/hi/hello" and "//hello" would both match
// This is a special modifier that is implemented in this library and not in `path-to-regexp`
path: /:qux@/:quuz
}
See path-to-regexp for more details.
Does it support optional parameters in the path definition?
Not yet, but it will as soon as I need them in a project.
Does it support SSR?
No.
Will it ever support SSR?
NO.
Does it have tests?
TypeScript is poor man's tests.
Will it ever have tests?
If you write them.
Does it support code splitting?
Did you see which repo you're actually browsing?
Does it say "facebook" in the url? No. So, no.
Does it support async routes?
Please stop doing stupid stuff with your router.
Does it support protected routes?
Please stop doing stupid stuff with your router.
I'm offended by this FAQ section, where can I complain?
Yell @ me on Twitter
FAQs
For the times when you *really* need a simple router. Based on [mobx-router](https://github.com/kitze/mobx-router) and [rttr](https://github.com/kitze/rttr).
The npm package @graywolfai/react-tiniest-router receives a total of 6 weekly downloads. As such, @graywolfai/react-tiniest-router popularity was classified as not popular.
We found that @graywolfai/react-tiniest-router demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.