- accepted / - tried
Create a hook usePrevious() to return the previous value, with initial value of `undefined.
usePrevious()
Bugfree ordinary solution is better than buggy fancy ones.
Try it out
Console