79131687

Date: 2024-10-27 23:21:06
Score: 1
Natty:
Report link

Yes I find this confusing as well. To access the latest state, we need to get it from the store:

const handleSortChange = async (event) => {
  setSort(event.value)  
  console.log(event.value)
  console.log(sortBy) //  event.value != sortBy
  console.log(store.getState().sortBy) // event.value == sortBy
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: user2425402