What is this?
This custom hook allows you to get previous value from the useState
Installation vie package manager
yarn add use-prev
npm install use-prev
Usage
; ; { const click setClick = ; const prevClick = ; const increment = ; return <> <p>Current Click Value: click</p> // 1 <p>Previous Click Value: prevClick</p> // 0 <button onClick=increment> Increment </button> </> }