Open Jernik opened 1 year ago
I have figured out the answers to my questions, but my complaints about the missing sections in the docs still stand
I'm having issues as well and looked for documentation to verify if I'm doing something wrong. Is there an ETA on the addition?
I have spent a couple hours figuring out how nested routes work juste because no mention of the Outlet component is made in the createBrowserRouter docs. I would advocate for a simple mention in the section where nested routes are described.
Agreed. Surprised such an essential aspect of routing is completely missing from the docs. Definitely less tempted to try Remix seeing how the docs for the main react-router library are maintained.
This issue has been automatically marked stale because we haven't received a response from the original author in a while 🙈. This automation helps keep the issue tracker clean from issues that are not actionable. Please reach out if you have more information for us or you think this issue shouldn't be closed! 🙂 If you don't do so within 7 days, this issue will be automatically closed.
There is still a todo on this section. This issue is not stale.
It would be nice for the docs to be more detailed and discuss best practices, but until then I've found the React Router in Depth series (not my videos) to be helpful for less senior devs to at least pick up the basics (especially video #4).
It's not just "more" detail though, it's a fundamental part of nesting, no? Like the OP, I'm still wondering how to make a child a default.
Definitely puts me completely off even trying Remix.
*Edit:
Make the default child's path '/' like the parent.
const router = createBrowserRouter([
{
path: "/",
element: <AppLayout />,
errorElement: <ErrorMessage />,
children: [
{
path: "/",
element: <Test />,
},
{
path: "typescript",
element: <Test2 />,
},
],
},
]);
Hi, @brophdawg11 @ryanflorence if anyone is not working on this issue then can I try to write docs for the children
prop of the Route
element.
Documentation is hard! We're doing some major docs overhauls in Remix at the moment and I expect those ideas will make it back into React Router as well once it's completed and Remix v2 is out.
Most of the information asked in this thread is in the docs somewhere today but potentially missing some cross-links (and maybe that's all we need for the children
TODO for now). If folks want to help full in some blanks and/or cross-links in the meantime it would be appreciated!
Here's some of the current areas that might benefit from being cross-linked to:
Route
component docs.An FAQ would also be helpful. I looked there first. A good question would be:
Q: Why does nested routes use
<Outlet/>
instead ofprops.children
?
Also actually looking for the answer. Has been asked:
Still no updates on the children
docs? I'm new to learning react-router for my Electron project and found that this section is crucial
What version of React Router are you using?
v6.4
Steps to Reproduce
Go to https://reactrouter.com/en/main/route/route#children See that there is a big TODO on a core concept Shrug and guess you'll have to dig into the source code to figure out the answer to your question.
Expected Behavior
Documentation to exist when I look for it
Actual Behavior
There is just a TODO from 6 months ago from this PR: https://github.com/remix-run/react-router/pull/8937
for a little more context, my questions are: With nested routes, how do I have a "default" child for the
<Outlet />
, and what is the recommended way to get route parameters into child components? Should I just use theuseParams
hook?