rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

RFC: Context should accept non-children props as value

Open Gokul-Gireesh opened this issue 6 months ago • 6 comments

This RFC proposes allowing React Context to accept non-children props as the provided value.

  • Keeps value for backward compatibility.
  • If no value is passed, all non-children props become the context value.
  • Excludes children from injection.
  • Simplifies context usage and makes it consistent with normal prop-passing in React.

Example:

<MyContext foo={foo} bar={bar}>
  <App />
</MyContext>

Consumer:

const { foo, bar } = useContext(MyContext);

Gokul-Gireesh avatar Aug 30 '25 16:08 Gokul-Gireesh