Skip to content

Commit 30dd371

Browse files
committed
Fix context provider references in createContext documentation
1 parent 92f9c69 commit 30dd371

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/content/reference/react/createContext.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ const ThemeContext = createContext('light');
3838

3939
`createContext` returns a context object.
4040

41-
**The context object itself does not hold any information.** It represents _which_ context other components read or provide. Typically, you will use [`SomeContext.Provider`](#provider) in components above to specify the context value, and call [`useContext(SomeContext)`](/reference/react/useContext) in components below to read it. The context object has a few properties:
41+
**The context object itself does not hold any information.** It represents _which_ context other components read or provide. Typically, you will use [`SomeContext`](#provider) in components above to specify the context value, and call [`useContext(SomeContext)`](/reference/react/useContext) in components below to read it. The context object has a few properties:
4242

43-
* `SomeContext.Provider` lets you provide the context value to components.
43+
* `SomeContext` lets you provide the context value to components.
4444
* `SomeContext.Consumer` is an alternative and rarely used way to read the context value.
4545

4646
---
4747

48-
### `SomeContext.Provider` {/*provider*/}
48+
### `SomeContext` {/*provider*/}
4949

5050
Wrap your components into a context provider to specify the value of this context for all components inside:
5151

@@ -54,9 +54,9 @@ function App() {
5454
const [theme, setTheme] = useState('light');
5555
// ...
5656
return (
57-
<ThemeContext.Provider value={theme}>
57+
<ThemeContext value={theme}>
5858
<Page />
59-
</ThemeContext.Provider>
59+
</ThemeContext>
6060
);
6161
}
6262
```
@@ -141,11 +141,11 @@ function App() {
141141
// ...
142142

143143
return (
144-
<ThemeContext.Provider value={theme}>
145-
<AuthContext.Provider value={currentUser}>
144+
<ThemeContext value={theme}>
145+
<AuthContext value={currentUser}>
146146
<Page />
147-
</AuthContext.Provider>
148-
</ThemeContext.Provider>
147+
</AuthContext>
148+
</ThemeContext>
149149
);
150150
}
151151
```
@@ -187,11 +187,11 @@ import { ThemeContext, AuthContext } from './Contexts.js';
187187
function App() {
188188
// ...
189189
return (
190-
<ThemeContext.Provider value={theme}>
191-
<AuthContext.Provider value={currentUser}>
190+
<ThemeContext value={theme}>
191+
<AuthContext value={currentUser}>
192192
<Page />
193-
</AuthContext.Provider>
194-
</ThemeContext.Provider>
193+
</AuthContext>
194+
</ThemeContext>
195195
);
196196
}
197197
```

0 commit comments

Comments
 (0)