usePrevious

Get the value a variable had on the previous render.

This is custom React hooks, you need to follow the Basic Rules when you use it.

General

It is null on the first render.

APIs

usePrevious

const usePrevious = <T>(value: T) => T | undefined | null
Edit this page on GitHub