package.src.useDeepEqualMemo.ts Maven / Gradle / Ivy
import { useRef } from 'react'
import deepEqual from './deepEqual'
export default function useDeepEqualMemo(value: T) {
const ref = useRef(undefined)
if (!deepEqual(ref.current, value)) {
ref.current = value
}
return ref.current
}