BFE.dev
buy us
a coffee
Codingproblems
Reactproblems
JavaScriptquizzes
Reactquizzes
TypeScriptpuzzles
CSSproblems
Interviewquestions
SystemDesign
Discussanything
buy us
a coffee

5. usePrevious()

ReactHooks
Share

  - accepted / - tried

Create a hook usePrevious() to return the previous value, with initial value of `undefined.

prevnext

Bugfree ordinary solution is better than buggy fancy ones.

Try it out

Console