educative.io

Why was the resetRef declared but not used? Wasn't it supposed to be the default value of resetDep?

Hi Justin!
We’ve set the value of resetDep as useState instead of useRef because useRef lack the re-render property. Further, whenever we want our variable to be something that decides a view layer render, we’ll go with the useState instead of using useRef.

Hope it will clear your confusion. If you still have any queries please let us know.
Thank you.

1 Like

Thank you!