Common mistake I see in React apps: Putting state in the wrong spot
Common mistake I see in React apps: Putting state in the wrong spot.
Simple strategy:
1. Put state in the component that needs it.
2. Do child components need the data too? Pass it down.
3. Do parents need it? Lift state up.
Strive to keep state as low as possible.
#reactjs