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