mobx-react-use-autorun 3.0.27 → 3.0.29

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 +17 -12
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -49,7 +49,7 @@ Form validation<br/>
49
49
  submit: false,
50
50
  errors: {
51
51
  get name() {
52
- return state.submit && !state.name && "请填写名称";
52
+ return state.submit && !state.name && "Please fill in the username";
53
53
  },
54
54
  get hasError() {
55
55
  return Object.keys(state.errors).filter(s => s !== "hasError").some(s => (state.errors as any)[s]);
@@ -60,29 +60,34 @@ Form validation<br/>
60
60
  const ok = async () => {
61
61
  state.submit = true;
62
62
  if (state.errors.hasError) {
63
- MessageService.error("错误");
63
+ MessageService.error("Error");
64
64
  } else {
65
- MessageService.success("提交成功");
65
+ MessageService.success("Submitted successfully");
66
66
  }
67
67
  }
68
68
 
69
69
  return (<div className='flex flex-col' style={{ padding: "2em" }}>
70
- <TextField value={state.name} label="用户名" onChange={(e) => state.name = e.target.value} error={!!state.errors.name} helperText={state.errors.name} />
71
- <Button variant="contained" style={{ marginTop: "2em" }} onClick={ok} >提交</Button>
70
+ <TextField value={state.name} label="Username" onChange={(e) => state.name = e.target.value} error={!!state.errors.name} helperText={state.errors.name} />
71
+ <Button variant="contained" style={{ marginTop: "2em" }} onClick={ok} >Submit</Button>
72
72
  </div>)
73
73
  })
74
74
 
75
75
  useMobxState provides two usages.<br/>
76
76
 
77
- useMobxState({},{}) is easy to use, you can define state and third-party hooks.<br/>
77
+ useMobxState({
78
78
 
79
+ },{})
79
80
 
80
- useMobxState(()=>({
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/>
81
+ is easy to use, you can define state and third-party hooks.<br/>
82
+
83
+ useMobxState(()=>({
84
+ get (){
85
+ return state.name
86
+ },
87
+ name: string = 'tom',
88
+ }),{})
89
+
90
+ 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
91
 
87
92
  ## Notes - Subscription property changes with useMobxEffect
88
93
 
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"mobx-react-use-autorun","version":"3.0.27","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.29","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/"}}