Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored Jun 3, 2022
1 parent 1302ad7 commit 9a5bf3e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions beta/src/pages/apis/usecontext.md
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ Call `useContext` at the top level of your component to read and subscribe to [c
import { useContext } from 'react';

function MyComponent() {
const theme = useTheme(ThemeContext);
const theme = useContext(ThemeContext);
// ...
```
Expand Down Expand Up @@ -1392,4 +1392,4 @@ In both of these cases you should see a warning from React in the console. To fi
</ThemeContext.Provider>
```
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.
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 comments on commit 9a5bf3e

Please sign in to comment.