You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

21 lines
493 B

  1. import { EffectCallback } from 'react';
  2. /**
  3. * Run's an effect on mount, and is cleaned up on unmount. Generally
  4. * useful for interop with non-react plugins or components
  5. *
  6. * ```ts
  7. * useMountEffect(() => {
  8. * const plugin = $.myPlugin(ref.current)
  9. *
  10. * return () => {
  11. * plugin.destroy()
  12. * }
  13. * })
  14. * ```
  15. * @param effect An effect to run on mount
  16. *
  17. * @category effects
  18. */
  19. declare function useMountEffect(effect: EffectCallback): void;
  20. export default useMountEffect;