Wrap <Link />
and redirect
#20
Locked
frontsideair
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
Hey @frontsideair. Thank you for your proposal! I think this would be out of the scope of this package. Did you encounter any difficulties? The usage is actually very simple: redirect(route("/my-route"));
<Link to={route("/my-route")} /> Besides that, you could have routes with dynamic params. So to implement your proposal, we'd need this sort of API: import { redirect, Link } from "routes-gen";
redirect("/products/:id", { id: "123" });
<Link to="/products/:id" routeParams={{ id: "123" }} /> Which is an overkill IHMO. Fewer abstractions are usually the best practice, and composition is the way to go. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It would be nice if this library generated type-safe versions of
<Link />
andredirect
so we can use these safer ones instead of importing from Remix.Beta Was this translation helpful? Give feedback.
All reactions