usePreviousRef
Return a ref object whose .current
property is assigned to previous updated value. The first time is undefined
.
API
function usePreviousRef<T>(value: T): React.MutableRefObject<T | undefined>;
Example
import React from "react";
import { usePreviousRef } from "@lilib/hooks";
function Example(props) {
const valueRef = usePreviousRef(props.value)
...
}