@real-router/react/ink — a packaged alternative to the MemoryRouter routing recipe #939
greydragon888
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all 👋
Following the routing recipe merged in #874, I wanted to share a packaged take on the same problem:
@real-router/react/ink— a subpath export on@real-router/reactthat ships a focus-aware<InkLink>and pairs with@real-router/memory-plugininstead of React Router'sMemoryRouter.What the recipe recommends (recap)
So each menu entry ends up being a hand-rolled
useInput+useNavigatepair, and there's no Link-equivalent out of the box.What this adds on top
<InkLink>— joins Ink's focus ring viauseFocus, Enter callsrouter.navigate(...). Props mirror what you'd expect (routeName,routeParams,activeColor,focusColor,inverse/activeInverse,onSelect,id,autoFocus).InkRouterProvider— provider without any DOM-specific bits (noannounceNavigation/ aria-live).useRouteNode("users")subscribes to theusers.*subtree only, which maps naturally onto Ink's section-based rendering.import { InkLink, InkRouterProvider, useRouteNode } from "@real-router/react/ink".Minimal example:
Requirements
Ink 7+, React 19.2+, Node 22+ — same floor Ink itself uses.
inkis an optional peer dependency, so consumers who only use the browser entries don't get install prompts for it.Links
examples/react/ink-demo/): https://github.com/greydragon888/real-router/tree/master/examples/react/ink-demoCaveats / asks
<InkLink>prop surface, hook ergonomics in Ink apps) is very welcome.Happy to answer questions, and thanks for Ink — it's a joy to build on top of. 🙌
Beta Was this translation helpful? Give feedback.
All reactions