-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[v6] Pass props to Outlet component #7590
Comments
I somekind make this work by doing this: return React.cloneElement(outlet.props.children.props.element, { profile, onProfileCreated}); |
I changed my return for this instead because Create and Update component requires function props and I cannot set them to something relevant into my AppRoute file. return (
<Routes>
<Route path="/" element={<ViewProfile profile={profile} />} />
<Route path="create" element={<CreateProfile profile={profile} onProfileCreated={onProfileCreated} />} />
<Route path="update" element={<Update profile={profile} onProfileUpdated={onProfileUpdated} />} />
</Routes>
); Here's my AppRoutes now: <Routes>
<Route path="profile/*" element={<Profile />} />
</Routes> |
👋 @sebascomeau, we use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. For usage questions, please use Stack Overflow or Reactiflux where there are a lot more people ready to help you out. |
So this is the only way?
How about this from @sebascomeau ?
|
Co-authored-by: Pedro Cattori <[email protected]>
Here's my route:
I want to add props to Outlet's element but adding props to the component doesn't work. Profile is the state component of view, create and update children component.
Example:
I'm trying with useOutlet hooks but I cannot found a way to modify the outlet.props.children.props.element.props property and returning outlet.
Any feedback is appreciated.
The text was updated successfully, but these errors were encountered: