etudes 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useMounted(): boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
var react_1 = require("react");
|
|
20
|
+
function useMounted() {
|
|
21
|
+
var _a = __read((0, react_1.useState)(false), 2), isMounted = _a[0], setIsMounted = _a[1];
|
|
22
|
+
(0, react_1.useEffect)(function () {
|
|
23
|
+
setIsMounted(true);
|
|
24
|
+
return function () {
|
|
25
|
+
setIsMounted(false);
|
|
26
|
+
};
|
|
27
|
+
}, []);
|
|
28
|
+
return isMounted;
|
|
29
|
+
}
|
|
30
|
+
exports.default = useMounted;
|
|
31
|
+
//# sourceMappingURL=useMounted.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMounted.js","sourceRoot":"/","sources":["hooks/useMounted.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+BAA2C;AAE3C,SAAwB,UAAU;IAC1B,IAAA,KAAA,OAA4B,IAAA,gBAAQ,EAAC,KAAK,CAAC,IAAA,EAA1C,SAAS,QAAA,EAAE,YAAY,QAAmB,CAAA;IAEjD,IAAA,iBAAS,EAAC;QACR,YAAY,CAAC,IAAI,CAAC,CAAA;QAElB,OAAO;YACL,YAAY,CAAC,KAAK,CAAC,CAAA;QACrB,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,SAAS,CAAA;AAClB,CAAC;AAZD,6BAYC","sourcesContent":["import { useEffect, useState } from 'react'\n\nexport default function useMounted() {\n const [isMounted, setIsMounted] = useState(false)\n\n useEffect(() => {\n setIsMounted(true)\n\n return () => {\n setIsMounted(false)\n }\n }, [])\n\n return isMounted\n}\n"]}
|