-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
docs(react testing): Update testing docs to demo nested route fields #15069
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
|
||
| ```tsx | ||
| function TestComponent() { | ||
| const { id } = useOutletContext(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should suggest they use a typed hook no? These return unknown.
Really they should be typed as
interface OutletContext {
id: string
}
export function useWhateverOutletContext() {
return useOutletContext<OutletContext>();
}
export function MyParentView() {
return <Outlet id="whatever" />
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yeah. i can add that in so it's most copy+pasteable
This documents some new nested-route fields that were added in getsentry/sentry#100481
Note
Extend RTL testing docs with outlet context configuration and nested routes examples, plus a clarified route param section.
routeforuseParams().initialRouterConfig.outletContextand consuming viauseOutletContext().initialRouterConfig.children.Outletwith typed context and custom hook, plus examples for index and param child routes.Written by Cursor Bugbot for commit c139854. This will update automatically on new commits. Configure here.