curriculum icon indicating copy to clipboard operation
curriculum copied to clipboard

Managing State With The Context API: Update Context Provider usage to reflect React 19 changes

Open notginned opened this issue 8 months ago • 3 comments

Checks

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

notginned avatar May 11 '25 19:05 notginned

@TheOdinProject/react Can someone take a look please

CouchofTomato avatar May 12 '25 12:05 CouchofTomato

I would like to contribute.

Parag-develop avatar May 18 '25 06:05 Parag-develop

This issue is stale because it has had no activity for the last 30 days.

github-actions[bot] avatar Jun 18 '25 02:06 github-actions[bot]

This issue is stale because it has had no activity for the last 30 days.

github-actions[bot] avatar Sep 03 '25 02:09 github-actions[bot]

@TheOdinProject/react This still needs review

CouchofTomato avatar Sep 04 '25 14:09 CouchofTomato

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).

mao-sz avatar Sep 04 '25 14:09 mao-sz