Browse Source

Fix typo (#2021)

* Fix typo

Adds a missing word

* Update content/docs/hooks-faq.md

Co-Authored-By: Alexey Pyltsyn <lex61rus@gmail.com>
main
Gavin Elster 6 years ago
committed by Alexey Pyltsyn
parent
commit
8d9b002130
  1. 2
      content/docs/hooks-faq.md

2
content/docs/hooks-faq.md

@ -694,7 +694,7 @@ function Counter() {
In more complex cases (such as if one state depends on another state), try moving the state update logic outside the effect with the [`useReducer` Hook](/docs/hooks-reference.html#usereducer). [This article](https://adamrackis.dev/state-and-use-reducer/) offers an example of how you can do this. **The identity of the `dispatch` function from `useReducer` is always stable** — even if the reducer function is declared inside the component and reads its props. In more complex cases (such as if one state depends on another state), try moving the state update logic outside the effect with the [`useReducer` Hook](/docs/hooks-reference.html#usereducer). [This article](https://adamrackis.dev/state-and-use-reducer/) offers an example of how you can do this. **The identity of the `dispatch` function from `useReducer` is always stable** — even if the reducer function is declared inside the component and reads its props.
As a last resort, if you want to something like `this` in a class, you can [use a ref](/docs/hooks-faq.html#is-there-something-like-instance-variables) to hold a mutable variable. Then you can write and read to it. For example: As a last resort, if you want something like `this` in a class, you can [use a ref](/docs/hooks-faq.html#is-there-something-like-instance-variables) to hold a mutable variable. Then you can write and read to it. For example:
```js{2-6,10-11,16} ```js{2-6,10-11,16}
function Example(props) { function Example(props) {

Loading…
Cancel
Save