React 18

Last Updated: 10/14/2023

Choose State Structure

  • To keep state as minimal as possible, avoid redundant state variables that can be computed from existing variables.
  • Group related state variables into an object to keep them organized.
  • Avoid deeply nested state objects as they can be hard to update and maintain.
const [person, setPerson] = useState({firstName: "ganesh", lastName: "kumar"});
const [loading, setLoading] = useState(false);