How to use the use-deep-compare-effect.useDeepCompareEffectNoCheck function in use-deep-compare-effect

To help you get started, we’ve selected a few use-deep-compare-effect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hemlok / spring-keyframes / packages / react-emotion / src / useSpring.ts View on Github external
...options,
    },
  })

  if (whileTap || whileHover) {
    useWhileInteraction({
      ref,
      animateToFrame,
      from: to,
      whileHover,
      whileTap,
    })
  }

  // Deep compare the `animate|to` @Frame so that we can animate updates.
  useDeepCompareEffectNoCheck(() => {
    if (!mountRef.current) {
      animateToFrame(to, true)
      mountRef.current = true
      return
    }

    if (!isVisible && exit) {
      animateToFrame(exit, true)
    } else {
      if (isExiting) return
      animateToFrame(to, true)
    }

    visibilityRef.current = isVisible
  }, [isVisible, to])

use-deep-compare-effect

It's react's useEffect hook, except using deep comparison on the inputs, not reference equality

MIT
Latest version published 3 years ago

Package Health Score

74 / 100
Full package analysis

Similar packages