mobx-react-use-autorun 3.0.39 → 3.0.41

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.
Files changed (2) hide show
  1. package/README.md +8 -8
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -57,22 +57,22 @@ Form validation<br/>
57
57
  name: "",
58
58
  submit: false,
59
59
  errors: {
60
- get name() {
60
+ name() {
61
61
  return state.submit &&
62
62
  !state.name &&
63
63
  "Please fill in the username";
64
64
  },
65
- get hasError() {
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
- get myInfo(){
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
- 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/>
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.39","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/"}}
1
+ {"name":"mobx-react-use-autorun","version":"3.0.41","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/"}}