In situations where the next state depends on the previous state, it's recommended to use a ________ function with setState or useState.

  • asynchronous
  • callback
  • immutable
  • sync
In situations where the next state depends on the previous state, it's recommended to use a callback function with setState or useState. This is because JavaScript's state updates can be asynchronous, and using a callback ensures that you're working with the latest state when updating it.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *