From cc007751cab22d5bbd00a4778c40dc00351ee200 Mon Sep 17 00:00:00 2001 From: Arshita Kakkar Date: Mon, 9 Mar 2020 19:04:04 +0530 Subject: [PATCH] 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 --- content/docs/hooks-faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/hooks-faq.md b/content/docs/hooks-faq.md index 87ef35b91..2f9e22038 100644 --- a/content/docs/hooks-faq.md +++ b/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. -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: