How to handle state in React.
Osmel Mora
1.7K13

Let’s say you’re writing a stateful, reusable, react component named Foo. It has complex state and logic, much of which shouldn’t be exposed to a user.

How should you handle the case where Foo’s parent needs to set that state (for example, reset Foo back to default when a user clicks a button)?