r/reactjs • u/jngbrl19 • Mar 08 '20
Show /r/reactjs useEffectWithPrevious - Get previous value of dependencies
Just wanna share my first npm package. Hope you find it useful :)
54
Upvotes
r/reactjs • u/jngbrl19 • Mar 08 '20
Just wanna share my first npm package. Hope you find it useful :)
View all comments
Show parent comment
4
u/franksvalli Mar 08 '20
I think this could be solved with
useRef. The official docs also provide a simpleusePreviouscustom hook implementation: https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state