mobx-react-use-autorun 3.0.26 → 3.0.28
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 +11 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,13 +76,14 @@ useMobxState provides two usages.<br/>
|
|
|
76
76
|
|
|
77
77
|
useMobxState({},{}) is easy to use, you can define state and third-party hooks.<br/>
|
|
78
78
|
|
|
79
|
+
useMobxState(()=>({
|
|
80
|
+
get (){
|
|
81
|
+
return state.name
|
|
82
|
+
},
|
|
83
|
+
name: string = 'tom',
|
|
84
|
+
}),{})
|
|
79
85
|
|
|
80
|
-
|
|
81
|
-
get (){
|
|
82
|
-
return state.name
|
|
83
|
-
},
|
|
84
|
-
name,
|
|
85
|
-
}),{}) provides advanced usage, the state is executed only once, and the performance is better. At the same time, you can use the get computed property to recalculate when the computed value changes.<br/>
|
|
86
|
+
provides advanced usage, the state is executed only once, and the performance is better. At the same time, you can use the get computed property to recalculate when the computed value changes.<br/>
|
|
86
87
|
|
|
87
88
|
## Notes - Subscription property changes with useMobxEffect
|
|
88
89
|
|
|
@@ -103,7 +104,7 @@ useMobxState(()=>({
|
|
|
103
104
|
|
|
104
105
|
## Notes - Get the real data of the proxy object with toJS
|
|
105
106
|
|
|
106
|
-
toJS will cause data to be used,
|
|
107
|
+
toJS will cause data to be used, please do not execute toJS(state) in component rendering code, it may cause repeated rendering. Wrong Usage Demonstration:<br/>
|
|
107
108
|
|
|
108
109
|
import { toJS, observer, useMobxState } from 'mobx-react-use-autorun'
|
|
109
110
|
import { v1 } from 'uuid'
|
|
@@ -119,7 +120,7 @@ toJS will cause data to be used, Please do not execute toJS(state) in component
|
|
|
119
120
|
return null;
|
|
120
121
|
})
|
|
121
122
|
|
|
122
|
-
Other than that, all usages are correct. Example
|
|
123
|
+
Other than that, all usages are correct. Example:<br/>
|
|
123
124
|
|
|
124
125
|
import { toJS, useMobxEffect, observer, useMobxState } from 'mobx-react-use-autorun';
|
|
125
126
|
import { v1 } from 'uuid'
|
|
@@ -147,8 +148,8 @@ Other than that, all usages are correct. Example:
|
|
|
147
148
|
|
|
148
149
|
## Introduction to third-party hooks
|
|
149
150
|
|
|
150
|
-
useMount is executed when the component loaded
|
|
151
|
-
useUnmount is executed when the component is unmount
|
|
151
|
+
useMount is executed when the component loaded.<br/>
|
|
152
|
+
useUnmount is executed when the component is unmount.<br/>
|
|
152
153
|
|
|
153
154
|
import { useMount, useUnmount } from 'react-use'
|
|
154
155
|
import { Subscription, of, tap } from 'rxjs'
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"mobx-react-use-autorun","version":"3.0.
|
|
1
|
+
{"name":"mobx-react-use-autorun","version":"3.0.28","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.5.0","mobx-react-lite":">=3.3.0","react-use":">=17.3.2","rxjs":">=6.0.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/"}}
|