useMountEffect

    API

    import useMountEffect from '@restart/hooks/useMountEffect'
    • useMountEffect(effect: EffectCallback) => void

      Run's an effect on mount, and is cleaned up on unmount. Generally useful for interop with non-react plugins or components

      useMountEffect(() => {
      const plugin = $.myPlugin(ref.current)
      return () => {
      plugin.destroy()
      }
      })

      Parameters

      • effectEffectCallback

        An effect to run on mount

      Return Value void