UNPKG

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