Browse Source

minor update to wording for thinking-in-react.md (#3814)

main
Nico Lovejoy 3 years ago
committed by GitHub
parent
commit
e5f91308e1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      content/docs/thinking-in-react.md

2
content/docs/thinking-in-react.md

@ -137,7 +137,7 @@ So far, we've built an app that renders correctly as a function of props and sta
React makes this data flow explicit to help you understand how your program works, but it does require a little more typing than traditional two-way data binding.
If you try to type or check the box in the current version of the example, you'll see that React ignores your input. This is intentional, as we've set the `value` prop of the `input` to always be equal to the `state` passed in from `FilterableProductTable`.
If you try to type or check the box in the previous version of the example (step 4), you'll see that React ignores your input. This is intentional, as we've set the `value` prop of the `input` to always be equal to the `state` passed in from `FilterableProductTable`.
Let's think about what we want to happen. We want to make sure that whenever the user changes the form, we update the state to reflect the user input. Since components should only update their own state, `FilterableProductTable` will pass callbacks to `SearchBar` that will fire whenever the state should be updated. We can use the `onChange` event on the inputs to be notified of it. The callbacks passed by `FilterableProductTable` will call `setState()`, and the app will be updated.

Loading…
Cancel
Save