mobx-react-use-autorun 3.0.40 → 3.0.42
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/README.md +9 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
|
|
|
4
4
|
|
|
5
5
|
## Development environment setup
|
|
6
6
|
1. From https://code.visualstudio.com install Visual Studio Code.<br/>
|
|
7
|
-
2. From https://nodejs.org install nodejs
|
|
7
|
+
2. From https://nodejs.org install nodejs v18.<br/>
|
|
8
8
|
|
|
9
9
|
## Available Scripts
|
|
10
10
|
|
|
@@ -57,22 +57,22 @@ Form validation<br/>
|
|
|
57
57
|
name: "",
|
|
58
58
|
submit: false,
|
|
59
59
|
errors: {
|
|
60
|
-
|
|
60
|
+
name() {
|
|
61
61
|
return state.submit &&
|
|
62
62
|
!state.name &&
|
|
63
63
|
"Please fill in the username";
|
|
64
64
|
},
|
|
65
|
-
|
|
65
|
+
hasError() {
|
|
66
66
|
return Object.keys(state.errors)
|
|
67
67
|
.filter(s => s !== "hasError")
|
|
68
|
-
.some(s => (state.errors as any)[s]);
|
|
68
|
+
.some(s => (state.errors as any)[s]());
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}));
|
|
72
72
|
|
|
73
73
|
async function ok(){
|
|
74
74
|
state.submit = true;
|
|
75
|
-
if (state.errors.hasError) {
|
|
75
|
+
if (state.errors.hasError()) {
|
|
76
76
|
MessageService.error("Error");
|
|
77
77
|
} else {
|
|
78
78
|
MessageService.success("Submitted successfully");
|
|
@@ -84,8 +84,8 @@ Form validation<br/>
|
|
|
84
84
|
value={state.name}
|
|
85
85
|
label="Username"
|
|
86
86
|
onChange={(e) => state.name = e.target.value}
|
|
87
|
-
error={!!state.errors.name}
|
|
88
|
-
helperText={state.errors.name}
|
|
87
|
+
error={!!state.errors.name()}
|
|
88
|
+
helperText={state.errors.name()}
|
|
89
89
|
/>
|
|
90
90
|
<Button
|
|
91
91
|
variant="contained"
|
|
@@ -112,7 +112,7 @@ is easy to use, you can define state and third-party hooks.<br/>
|
|
|
112
112
|
The second:
|
|
113
113
|
|
|
114
114
|
useMobxState(() => ({
|
|
115
|
-
|
|
115
|
+
myInfo(){
|
|
116
116
|
return `${state.name}'s age is ${state.age}`
|
|
117
117
|
},
|
|
118
118
|
name: 'tom',
|
|
@@ -122,7 +122,7 @@ The second:
|
|
|
122
122
|
intl: useIntl(),
|
|
123
123
|
})
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
Provide a method to generate state, the state is executed only once, and the performance is better.<br/>
|
|
126
126
|
|
|
127
127
|
## Notes - Subscription property changes with useMobxEffect
|
|
128
128
|
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"mobx-react-use-autorun","version":"3.0.
|
|
1
|
+
{"name":"mobx-react-use-autorun","version":"3.0.42","description":"React Hook for mobx","scripts":{"test":"npx -y -p typescript -p ts-node ts-node --skipProject bin/mobx_react_test.ts","build":"npx -y -p typescript -p ts-node ts-node --skipProject bin/mobx_react_build.ts","make":"npx -y -p typescript -p ts-node ts-node --skipProject bin/mobx_react_make.ts"},"dependencies":{"mobx":"6.7.0","mobx-react-lite":"3.4.0","react-use":"17.4.0","rxjs":"7.5.7"},"peerDependencies":{"react":">=16.8.0"},"license":"MIT","keywords":["react","mobx","typescript"],"main":"./dist/index.js","types":"./dist/index.d.ts","eslintConfig":{"extends":["react-app","react-app/jest"]},"homepage":"https://github.com/zdu-strong/mobx-react-use-autorun#readme","repository":{"type":"git","url":"git+https://github.com/zdu-strong/mobx-react-use-autorun.git"},"files":["lib","dist"],"bugs":{"url":"https://github.com/zdu-strong/mobx-react-use-autorun/issues"},"publishConfig":{"registry":"https://registry.npmjs.org/"}}
|