Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/content/reference/react/createContext.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ In older versions of React, use `<SomeContext.Provider>`.

</Note>

> **Recommendation**
> In React 19+, rendering a Context directly (without `.Provider`) is valid.
> However, for most apps we **recommend** using `MyContext.Provider` explicitly because it keeps intent clear, helps avoid accidental default values, and makes future refactors safer.
> Consider the shorthand only when you intentionally rely on the default value in a very small or localized scope.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is not our recommendation. <Context.Provider> is legacy, use <Context>. In the React 19 blog post we said in the future we'll deprecate Context.Provider - as we eventually do with all legacy APIs.


#### Props {/*provider-props*/}

* `value`: The value that you want to pass to all the components reading this context inside this provider, no matter how deep. The context value can be of any type. A component calling [`useContext(SomeContext)`](/reference/react/useContext) inside of the provider receives the `value` of the innermost corresponding context provider above it.
Expand Down