All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy