Skip to content

Commit b5cf32d

Browse files
authored
Change wording
1 parent 23b1f4c commit b5cf32d

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

content/docs/context.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ Using context, we can avoid passing props through intermediate elements:
4545
const {Provider, Consumer} = React.createContext(defaultValue);
4646
```
4747

48-
Creates a `{ Provider, Consumer }` pair.
48+
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.
4949

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

5252
### `Provider`
5353

@@ -59,10 +59,6 @@ A React component that allows Consumers to subscribe to context changes.
5959

6060
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.
6161

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.
65-
6662
### `Consumer`
6763

6864
```js

0 commit comments

Comments
 (0)