Skip to content

Commit 7f04124

Browse files
authored
Update "top level" language to be less ambiguous with "levelContext" (#5807)
We use "top level" all over the docs, but this specific topic uses a different meaning of "level". If you're learning about passing context across multiple "levels" of components, this is actually pretty confusing and makes you think you can only useContext at, for example, the top level of your app.
1 parent 4b313b9 commit 7f04124

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/content/learn/passing-data-deeply-with-context.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ export default function Heading({ children }) {
336336
}
337337
```
338338

339-
`useContext` is a Hook. Just like `useState` and `useReducer`, you can only call a Hook at the top level of a React component. **`useContext` tells React that the `Heading` component wants to read the `LevelContext`.**
339+
`useContext` is a Hook. Just like `useState` and `useReducer`, you can only call a Hook immediately inside a React component (not inside loops or conditions). **`useContext` tells React that the `Heading` component wants to read the `LevelContext`.**
340340

341341
Now that the `Heading` component doesn't have a `level` prop, you don't need to pass the level prop to `Heading` in your JSX like this anymore:
342342

0 commit comments

Comments
 (0)