- accepted / - tried
Create a hook usePrevious() to return the previous value, with initial previous value of undefined.
usePrevious()
undefined
Always try to find a better approach.
Try it out
Console