What if the returned version was bound to a ref instead of the state directly? So whenever a new state was assigned, the ref.current would be updated and the function could always return the latest state.
I know, the array of diffs could help to solve the staling, but it implies that the consumer always use that state inside hooks callbacks, but it isn’t the case for asynchronous callbacks
What if the returned version was bound to a ref instead of the state directly? So whenever a new state was assigned, the ref.current would be updated and the function could always return the latest state.
I know, the array of diffs could help to solve the staling, but it implies that the consumer always use that state inside hooks callbacks, but it isn’t the case for asynchronous callbacks