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.
 
 
 
 

30 lines
599 B

  1. "use strict";
  2. exports.__esModule = true;
  3. exports.default = void 0;
  4. var _react = require("react");
  5. /**
  6. * Run's an effect on mount, and is cleaned up on unmount. Generally
  7. * useful for interop with non-react plugins or components
  8. *
  9. * ```ts
  10. * useMountEffect(() => {
  11. * const plugin = $.myPlugin(ref.current)
  12. *
  13. * return () => {
  14. * plugin.destroy()
  15. * }
  16. * })
  17. * ```
  18. * @param effect An effect to run on mount
  19. *
  20. * @category effects
  21. */
  22. function useMountEffect(effect) {
  23. return (0, _react.useEffect)(effect, []);
  24. }
  25. var _default = useMountEffect;
  26. exports.default = _default;