@1hook/use-mount-effect 0.0.1-beta.1

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,3 @@
1
+ declare function useMountEffect(callback: () => any): void;
2
+
3
+ export { useMountEffect };
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { useEventHandler } from '@1hook/use-event-handler';
3
+
4
+ // src/index.ts
5
+ function useMountEffect(callback) {
6
+ const _cb = useEventHandler(callback);
7
+ React.useEffect(() => {
8
+ _cb();
9
+ }, [_cb]);
10
+ }
11
+
12
+ export { useMountEffect };
13
+ //# sourceMappingURL=index.js.map
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;AAGO,SAAS,eAAe,QAAqB,EAAA;AAClD,EAAM,MAAA,GAAA,GAAM,gBAAgB,QAAQ,CAAA;AACpC,EAAA,KAAA,CAAM,UAAU,MAAM;AACpB,IAAI,GAAA,EAAA;AAAA,GACN,EAAG,CAAC,GAAG,CAAC,CAAA;AACV","file":"index.js","sourcesContent":["import React from 'react'\nimport { useEventHandler } from '@1hook/use-event-handler'\n\nexport function useMountEffect(callback: () => any) {\n const _cb = useEventHandler(callback)\n React.useEffect(() => {\n _cb()\n }, [_cb])\n}\n"]}
Binary file
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@1hook/use-mount-effect",
3
+ "version": "0.0.1-beta.1",
4
+ "files": [
5
+ "dist",
6
+ "README.md"
7
+ ],
8
+ "type": "module",
9
+ "exports": {
10
+ "./package.json": "./package.json",
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
16
+ "peerDependencies": {
17
+ "@types/react": ">=18.0.0 || >=19.0.0",
18
+ "@types/react-dom": ">=18.0.0 || >=19.0.0",
19
+ "react": ">=18.0.0 || >=19.0.0",
20
+ "react-dom": ">=18.0.0 || >=19.0.0"
21
+ },
22
+ "dependencies": {
23
+ "@1hook/use-event-handler": "0.0.1-beta.1"
24
+ },
25
+ "tag": "beta",
26
+ "scripts": {
27
+ "build": "NODE_ENV=production tsup",
28
+ "dev": "concurrently \"tsup --watch\" \"vitest\"",
29
+ "test": "vitest run && tsc --noEmit",
30
+ "lint": "eslint . && tsc --noEmit",
31
+ "lint:eslint": "eslint .",
32
+ "lint:typescript": "tsc --noEmit"
33
+ }
34
+ }