1 | ;
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports.default = void 0;
|
5 |
|
6 | var _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 | */
|
25 | function useMountEffect(effect) {
|
26 | return (0, _react.useEffect)(effect, []);
|
27 | }
|
28 |
|
29 | var _default = useMountEffect;
|
30 | exports.default = _default; |
\ | No newline at end of file |