You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creates a `{ Provider, Consumer }` pair. When React renders a context `Consumer`, it will read the current context value from the closest matching `Provider` above it in the tree.
49
49
50
-
Optionally accepts a default value to be passed to Consumers without a Provider ancestor. _Only Consumers that don't have a Provider higher in the tree receive the default value_.
50
+
The `defaultValue` argument is the context value React uses if you render a `Consumer`without a matching `Provider` above it in the tree. For example, this is helpful for testing components in isolation without wrapping them.
51
51
52
52
### `Provider`
53
53
@@ -59,10 +59,6 @@ A React component that allows Consumers to subscribe to context changes.
59
59
60
60
Accepts a `value` prop to be passed to Consumers that are descendants of this Provider. One Provider can be connected to many Consumers. Providers can be nested to override values deeper within the tree.
61
61
62
-
> Note:
63
-
>
64
-
> If `value` is not provided, Consumers receive `undefined`. To use the default value in a Consumer instead, remove the Provider altogether.
0 commit comments