useState examples and best practices

  • App1.js - use functional update to get the current value
  • App2.js - update a specific object property
  • App3.js - change all inputs with a single onChange
  • App4.js - useReducer for complex data shape
  • App5.js - if one state affect another one, just store its id