@itera-web/hooks-setstate 1.20.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.
package/LICENSE.md ADDED
File without changes
package/README.md ADDED
@@ -0,0 +1 @@
1
+ ### [使用文档](http://iterative.keyboardecho.com/)
package/es/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { useSetState } from './use-setstate';
package/es/index.js ADDED
@@ -0,0 +1 @@
1
+ import*as t from"react";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},r={};function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}e.d(r,{v:()=>c});const n=(t=>{var r={};return e.d(r,t),r})({useLayoutEffect:()=>t.useLayoutEffect,useRef:()=>t.useRef,useState:()=>t.useState});var u=function(){return u=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},u.apply(this,arguments)},c=function(t){var e=(0,n.useState)(t),r=e[0],c=e[1],f=(0,n.useRef)(t),a=(0,n.useRef)();return(0,n.useLayoutEffect)(function(){var t;f.current=r,null===(t=a.current)||void 0===t||t.call(a,r)},[r]),[r,function(t,e){var r;void 0===e&&(e=function(){return null}),a.current=e,r=t,f.current=r,r?"object"!==o(r)||r.constructor!==Object?c(r):c(function(t){return u(u({},t||{}),r)}):c(r)},function(){return f.current}]},f=r.v;export{f as useSetState};
@@ -0,0 +1,4 @@
1
+ type SetStateAction<S> = S | ((prevState: S) => S);
2
+ type Dispatch<A> = (value: A, callback?: Function) => void;
3
+ export declare const useSetState: <S>(initialState: S) => [S, Dispatch<SetStateAction<S>>, () => S];
4
+ export {};
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@itera-web/hooks-setstate",
3
+ "description": "自定义 useState",
4
+ "version": "1.20.0",
5
+ "main": "es/index.js",
6
+ "types": "es/index.d.ts",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "license": "MIT",
11
+ "scripts": {
12
+ "build": "itera-cli package",
13
+ "up": "npm publish"
14
+ },
15
+ "peerDependencies": {
16
+ "react": ">=17.0.0"
17
+ },
18
+ "devDependencies": {
19
+ "@itera-web/cli": "^1.1.45"
20
+ },
21
+ "gitHead": "8eee810020627ddc6fb8cb18fbc042cdcec7fb4b"
22
+ }