mobx-react-use-autorun 3.0.47 → 3.0.49
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 +12 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,11 +22,11 @@ Builds the files for production to the `dist` folder.<br/>
|
|
|
22
22
|
|
|
23
23
|
Publish to npm repository
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
# `Installation`
|
|
26
26
|
|
|
27
27
|
npm install mobx-react-use-autorun
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
# `Usage`
|
|
30
30
|
|
|
31
31
|
### Notes - Define state and props with useMobxState
|
|
32
32
|
|
|
@@ -59,7 +59,7 @@ Form validation<br/>
|
|
|
59
59
|
|
|
60
60
|
export default observer(() => {
|
|
61
61
|
|
|
62
|
-
const state = useMobxState(
|
|
62
|
+
const state = useMobxState({
|
|
63
63
|
name: "",
|
|
64
64
|
submit: false,
|
|
65
65
|
errors: {
|
|
@@ -74,7 +74,7 @@ Form validation<br/>
|
|
|
74
74
|
.some(s => (state.errors as any)[s]());
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
})
|
|
77
|
+
});
|
|
78
78
|
|
|
79
79
|
async function ok(){
|
|
80
80
|
state.submit = true;
|
|
@@ -107,7 +107,10 @@ The first:
|
|
|
107
107
|
|
|
108
108
|
useMobxState({
|
|
109
109
|
name: 'tom',
|
|
110
|
-
age: 16
|
|
110
|
+
age: 16,
|
|
111
|
+
myInfo(){
|
|
112
|
+
return `${state.name}'s age is ${state.age}`
|
|
113
|
+
},
|
|
111
114
|
}, {
|
|
112
115
|
...props,
|
|
113
116
|
init: useIntl(),
|
|
@@ -118,11 +121,11 @@ is easy to use, you can define state and third-party hooks.<br/>
|
|
|
118
121
|
The second:
|
|
119
122
|
|
|
120
123
|
useMobxState(() => ({
|
|
124
|
+
name: 'tom',
|
|
125
|
+
age: 13,
|
|
121
126
|
myInfo(){
|
|
122
127
|
return `${state.name}'s age is ${state.age}`
|
|
123
128
|
},
|
|
124
|
-
name: 'tom',
|
|
125
|
-
age: 13,
|
|
126
129
|
}), {
|
|
127
130
|
...props,
|
|
128
131
|
intl: useIntl(),
|
|
@@ -243,11 +246,11 @@ useUnmount is executed when the component is unmount.<br/>
|
|
|
243
246
|
return null;
|
|
244
247
|
})
|
|
245
248
|
|
|
246
|
-
|
|
249
|
+
# Learn More
|
|
247
250
|
|
|
248
251
|
1. React UI framework (https://reactjs.org)<br/>
|
|
249
252
|
2. React hooks (https://www.npmjs.com/package/react-use)<br/>
|
|
250
253
|
|
|
251
|
-
|
|
254
|
+
# License
|
|
252
255
|
|
|
253
256
|
This project is licensed under the terms of the [MIT license](./LICENSE).
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"mobx-react-use-autorun","version":"3.0.
|
|
1
|
+
{"name":"mobx-react-use-autorun","version":"3.0.49","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.8.0"},"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/"}}
|