-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raise route params higher in the component tree #2042
Comments
Looping in @Tobbe @KrisCoulson did you happen to see this PR that just merged today? It adds some nice, new features to Routes.js: See this syntax reference from the original RFC discussion: Possible this will provide the capability you're looking for? |
@thedavidprice I have been talking with @Tobbe about this. Told him I would create the issue. I pulled the canary version to test the upgrade for my use case. The Set component makes it possible to do what I am trying to do now. But it's a bit of a pain because I would have to manually parse the Something like this
|
Thanks! I just saw Tobbe opened #2043 simultaneously and assumed you're collaborating. |
@Tobbe could you provide a final example like the above in the PR description? |
You bet! |
Currently, the params from
useParams
are only accessible inside of a route component. With the introduction of theSet
component, we still cannot have dynamic Layouts. My initial suggestion is to raise theParamsContext.Provider
higher in the component architecture to be able to access the params in theSet
component. Currently, theParamsContext.Provider
is initialized in the PageLoader componentredwood/packages/router/src/page-loader.tsx
Lines 148 to 152 in 2a38022
Another solution would be to make params available as a prop in the
Set
component that passes those params to our Layout by default. This way you don't have to know touseParams
you just have access to them in your Layout.The text was updated successfully, but these errors were encountered: