Skip to content

Commit 9a5bf3e

Browse files
authored
Fix typo
1 parent 1302ad7 commit 9a5bf3e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

beta/src/pages/apis/usecontext.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ Call `useContext` at the top level of your component to read and subscribe to [c
13291329
import { useContext } from 'react';
13301330

13311331
function MyComponent() {
1332-
const theme = useTheme(ThemeContext);
1332+
const theme = useContext(ThemeContext);
13331333
// ...
13341334
```
13351335
@@ -1392,4 +1392,4 @@ In both of these cases you should see a warning from React in the console. To fi
13921392
</ThemeContext.Provider>
13931393
```
13941394
1395-
Note that the [default value from your `createContext(defaultValue)` call](#specifying-a-fallback-default-value) is only used **if there is no matching provider above at all.** If there is a `<SomeContext.Provider value={undefined}>` component somewhere in the parent tree, the component calling `useContext(SomeContext)` *will* receive `undefined` as the context value.
1395+
Note that the [default value from your `createContext(defaultValue)` call](#specifying-a-fallback-default-value) is only used **if there is no matching provider above at all.** If there is a `<SomeContext.Provider value={undefined}>` component somewhere in the parent tree, the component calling `useContext(SomeContext)` *will* receive `undefined` as the context value.

0 commit comments

Comments
 (0)