usePrevious
Returns the value passed on the previous render.
Loading preview...
The usePrevious hook returns the value from the immediately preceding render pass (undefined on the initial render).
Returns the value passed on the previous render.
The usePrevious hook returns the value from the immediately preceding render pass (undefined on the initial render).
import { usePrevious } from "@/hooks/usePrevious";const prevCount = usePrevious(count);