- accepted / - tried
Create a hook usePrevious() to return the previous value, with initial previous value of undefined.
usePrevious()
undefined
What is time & space complexity of your approach?
Try it out
Console