usePrevious()
2022年5月1日小于 1 分钟
usePrevious()
Question
Create a hook usePrevious()
to return the previous value, with initial value of `undefined.
Code
export function usePrevious<T>(value: T): T | undefined {
// your code here
}
// if you want to try your code on the right panel
// remember to export App() component like below
// export function App() {
// return <div>your app</div>
// }