Skip to content

Commit 5f3a975

Browse files
authored
Fix variable name to match example (#4615)
1 parent 09f8bcc commit 5f3a975

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

beta/src/pages/learn/reacting-to-input-with-state.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ You want to avoid duplication in the state content so you're only tracking what
374374
Here are some questions you can ask about your state variables:
375375

376376
* **Does this state cause a paradox?** For example, `isTyping` and `isSubmitting` can't both be `true`. A paradox usually means that the state is not constrained enough. There are four possible combinations of two booleans, but only three correspond to valid states. To remove the "impossible" state, you can combine these into a `status` that must be one of three values: `'typing'`, `'submitting'`, or `'success'`.
377-
* **Is the same information available in another state variable already?** Another paradox: `isEmpty` and `isTyping` can't be `true` at the same time. By making them separate state variables, you risk them going out of sync and causing bugs. Fortunately, you can remove `isEmpty` and instead check `message.length === 0`.
377+
* **Is the same information available in another state variable already?** Another paradox: `isEmpty` and `isTyping` can't be `true` at the same time. By making them separate state variables, you risk them going out of sync and causing bugs. Fortunately, you can remove `isEmpty` and instead check `answer.length === 0`.
378378
* **Can you get the same information from the inverse of another state variable?** `isError` is not needed because you can check `error !== null` instead.
379379

380380
After this clean-up, you're left with 3 (down from 7!) *essential* state variables:

0 commit comments

Comments
 (0)