How to get previous props/state with React Hooks Blog

added by JavaScript Kicks
1/2/2020 4:11:48 PM


Accessing the previous props or state from within a functional component is one of those deceptively simple problems you'll likely face as you work with React Hooks. There's currently no React Hook that does this out of the box, but you can manually retrieve either the previous state or props from within a functional component by leveraging the useRef hook.