State

  • implemented by useState
  • setState can take function as well as value in argument
const [name, setName] = useState('');

Lifting state up

  • practice of moving state from child components to their common ancestor.
  • allows the parent component to manage the state and pass it down to the child components as props.
  • useful when multiple components need to share and synchronize the same state

useReducer