frontend-interview-questions
frontend-interview-questions copied to clipboard
custom-useEffect hook does not function like useEffect.
trafficstars
In useEffect, when there is an update of state, the cleanup function of old state runs and then the callback function of the updated state runs. In your code, when there is an update of state, the callback function of the updated state runs and then the cleanup function of updated state runs. The cleanup runs same as callback.
@kobbin003 Were you able to solve this ?