reaxes-toolkit 1.0.2 → 1.0.3

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/changelog.md CHANGED
@@ -1,4 +1,9 @@
1
- # 1.0.0-Beta.1
1
+ # 1.0.2
2
+ * doc fixed & optimized
3
+ # 1.0.1
4
+ * doc optimized
5
+
6
+ # 1.0.0
2
7
  * 将orzImport转移至reaxes-utils中并改名为xImport
3
8
  * 将orzPending改名为rexaStatus , 并且所有toolkit函数统一使用rexa作为前缀
4
9
  * 清理了rexaStatus冗余的异步逻辑,现在已改为同步修改store
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reaxes-toolkit",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Toolkit Based on `reaxes`",
5
5
  "main": "esm/index.js",
6
6
  "module": "esm/index.js",
package/readme.md CHANGED
@@ -19,8 +19,8 @@ $ npm i -S reaxes-toolkit
19
19
 
20
20
  ### 🛠 在 `reaxel` 中使用
21
21
  ```tsx
22
- import { rexaStatus } from 'reaxes-toolkit';
23
22
  //reaxels/user-bio.ts
23
+ import { rexaStatus } from 'reaxes-toolkit';
24
24
  export const reaxel_UserBio = reaxel(() => {
25
25
  const { status,setStatus } = rexaStatus();
26
26
  const { store , setState , mutate } = createReaxable({
@@ -83,29 +83,25 @@ export default reaxper(() => {
83
83
  ### 🏗 纯 `React` 示例
84
84
  ```tsx
85
85
  const Test = reaxper(() => {
86
- const { current : {
87
- pendingState,
88
- setError,
89
- setPending
90
- } } = useRef(rexaStatus());
86
+ const { current : { status,setStatus } } = useRef(rexaStatus());
91
87
  const [ data , setData ] = useState(null);
92
88
 
93
89
  useEffect(() => {
94
90
  fetch(`api.com`).
95
91
  then(( data ) => {
96
92
  setData(data);
97
- setPending(false);
93
+ setStatus({pending:false});
98
94
  }).
99
95
  catch(e => {
100
- setError(e);
96
+ setStatus({pending:false,error:e});
101
97
  });
102
98
  },[]);
103
99
 
104
- if( pendingState.pending ) {
100
+ if( status.pending ) {
105
101
  return <div>pending...</div>;
106
102
  }
107
103
 
108
- if( pendingState.error ) {
104
+ if( status.error ) {
109
105
  return <div>Error!</div>;
110
106
  }
111
107