Browse Source

Documentation correction (#2304)

* Documentation error

Line 290 - ". However, instead we recommend to split state into multiple state variables based on which values tend to change together."
Both 'however' and 'instead' are contrasting words and only one of them should be used. 
Either "Instead we recommend to split state into multiple state variables based on which values tend to change together." OR "However, we recommend to split state into multiple state variables based on which values tend to change together."
Updated the sentence.

* Updated 'however' to 'instead'

Line 290 updated to - 
Instead, **we recommend to split state into multiple state variables based on which values tend to change together.**

* Update hooks-faq.md

Co-authored-by: Sunil Pai <threepointone@fb.com>
main
Arshita Kakkar 5 years ago
committed by GitHub
parent
commit
cc007751ca
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      content/docs/hooks-faq.md

2
content/docs/hooks-faq.md

@ -289,7 +289,7 @@ Now let's say we want to write some logic that changes `left` and `top` when the
This is because when we update a state variable, we *replace* its value. This is different from `this.setState` in a class, which *merges* the updated fields into the object. This is because when we update a state variable, we *replace* its value. This is different from `this.setState` in a class, which *merges* the updated fields into the object.
If you miss automatic merging, you can write a custom `useLegacyState` Hook that merges object state updates. However, instead **we recommend to split state into multiple state variables based on which values tend to change together.** If you miss automatic merging, you could write a custom `useLegacyState` Hook that merges object state updates. However, **we recommend to split state into multiple state variables based on which values tend to change together.**
For example, we could split our component state into `position` and `size` objects, and always replace the `position` with no need for merging: For example, we could split our component state into `position` and `size` objects, and always replace the `position` with no need for merging:

Loading…
Cancel
Save