Managing State With The Context API: Update Context Provider usage to reflect React 19 changes
Checks
- [x] This is not a duplicate of an existing issue (please have a look through our open issues list to make sure)
- [x] I have thoroughly read and understand The Odin Project Contributing Guide
- [x] Would you like to work on this issue?
Describe your suggestion
Proposal
- Change the way we use Context Providers within the lesson.
Changes
- Update all references of
<ContextObject.Provider>to<ContextObject>within the lesson text. - Update all references of
<ContextObject.Provider>to<ContextObject>within the code snippets. - Simplify the steps of "Implementing the Context API" section to reflect the new syntax.
- Add a note mentioning that
<ContextObject.Provider>is legacy syntax, and how one might still find it in existing codebases.
Alternatively, we can keep the current usage as is and add a note about not needing the <ContextObject.Provider> component anymore starting with React 19 instead.
Reasoning
- React 19 has changed the way that Context Providers are used. The preferred way now is to use the
<Context>component directly as the Context Provider.<Context.Provider>is slated to be deprecated in future versions. - The React docs have already updated with the new method of invocation, and discrepancy with the docs may lead to confusion for learners.
Path
Node / JS
Lesson Url
https://www.theodinproject.com/lessons/node-path-react-new-managing-state-with-the-context-api
(Optional) Discord Name
ginned
(Optional) Additional Comments
No response
@TheOdinProject/react Can someone take a look please
I would like to contribute.
This issue is stale because it has had no activity for the last 30 days.
This issue is stale because it has had no activity for the last 30 days.
@TheOdinProject/react This still needs review
Ah, this one slipped through the cracks, so a duplicate was opened last week and will currently be fixed by #30038 (I've added this issue to that one to close when merged).