curriculum icon indicating copy to clipboard operation
curriculum copied to clipboard

React Router: <Replace the link pointing to auto generated useOutletContex docs>

Open GaneshS288 opened this issue 10 months ago • 7 comments

Checks

Describe your suggestion

In Outlets and State section of the lesson the link to useOutletContext docs points to auto generated documentation.

https://reactrouter.com/en/main/hooks/use-outlet-context

This is about as useful as you can imagine. I couldn't find anything on the v7.1.5 docs but the v6.29 docs have proper documentation for useOutletContext, so I suggest changing the link to this

https://reactrouter.com/6.29.0/hooks/use-outlet-context

Path

Node / JS

Lesson Url

https://www.theodinproject.com/lessons/node-path-react-new-react-router

(Optional) Discord Name

evilganesh

(Optional) Additional Comments

No response

GaneshS288 avatar Feb 07 '25 17:02 GaneshS288

I would also suggest replacing the sentence that recommends the Navigate component:

This is where we use the Navigate component.

Because the page in the docs that it links to says:

It's recommended to avoid using this component in favor of useNavigate

https://api.reactrouter.com/v7/functions/react_router.Navigate.html

columk1 avatar Feb 07 '25 18:02 columk1

Are we piling on work on Ganesh? Count me in

The lesson assignment also links to react router tutorial and mentions going up to the "Nested Routes" section. There's another section just below it called "Client Side Routing" that's relevant as well, so we could change the suggestion to read up to "Client Side Routing"

  1. The React Router tutorial goes through a lot of the stuff discussed in this lesson and much more. Have a read through the sections up to “Nested Routes”.

This is a trivial change, so I figured it would be best to include it in this PR while we're at it.

gingkapls avatar Feb 09 '25 14:02 gingkapls

I wouldn't mind. There are more links that I didn't notice at first that seem to be auto generated docs too so they will need to be replaced with proper docs from v6.29.

Also agreed on "client side routing" section being relevant

GaneshS288 avatar Feb 09 '25 14:02 GaneshS288

@TheOdinProject/react Can someone take a look at this.

CouchofTomato avatar Feb 11 '25 19:02 CouchofTomato

React Router v7 docs have since received a much needed upgrade. v6-like guides have been added, albeit a little slimmer (though still sufficient). The most appropriate replacement link IMO would be https://reactrouter.com/api/components/Outlet since that explains enough about outlet context and also links to useOutletContext.

mao-sz avatar May 27 '25 23:05 mao-sz

The link to useOutletContext is pretty useless. Returns the parent route <Outlet context> isn't clear enough to say if it is returning the context or the element, even if the Outlet page tells you to use useOutletContext to access context there is no example to demonstrate the use. So, I wouldn't count it relevant for now unless they update that page too in future.

The outlet page itself is fine and it explains you can pass the context with context prop, but I would prefer if we had example code that showed useOutletContext being used.

if we go with this change, I will advocate to put an example code for useOutletContext right inside the lesson.

GaneshS288 avatar May 28 '25 07:05 GaneshS288

That seems sensible to me

mao-sz avatar May 28 '25 09:05 mao-sz

PR for this wasn't linked, but was merged today.

KevinMulhern avatar Jul 17 '25 15:07 KevinMulhern

@KevinMulhern while the title of this issue mentions the link for useOutletContext, later in the discussion we realized that there are multiple other links like useNavigate, Link etc that point to auto generated docs. So while the link for useOutletContext is fixed those other links are still the same.

I can create another issue if that would be better.

GaneshS288 avatar Jul 18 '25 12:07 GaneshS288