Skip to content

Commit 20327a2

Browse files
Merge pull request #17 from byte-fe/develop
docs(v1.1.0): Update Docs for new release.
2 parents d493d47 + 5dcd2d1 commit 20327a2

File tree

2 files changed

+5
-27
lines changed

2 files changed

+5
-27
lines changed

README.md

+4-26
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,7 @@ The State management library for React
88

99
## Quick Start
1010

11-
Running demo
12-
13-
```
14-
git clone https://github.com/byte-fe/react-modelx.git
15-
cd react-model/example
16-
npm i
17-
npm run initial
18-
npm run dev
19-
```
11+
[Next.js + react-modelx work around](https://github.com/ArrayZoneYour/react-modelx-experiment)
2012

2113
install package
2214

@@ -30,8 +22,6 @@ npm install react-modelx
3022

3123
react-model keep the state and actions in a global store. So you need to register them before using.
3224

33-
`index.ts`
34-
3525
```typescript
3626
import { Model } from 'react-modelx'
3727
import Home from '../model/home.model'
@@ -42,18 +32,6 @@ const models = { Home, Shared }
4232
export const { useStore } = Model(models)
4333
```
4434

45-
`index.js`
46-
47-
```javascript
48-
import { Model } from 'react-modelx'
49-
import Home from '../model/home.model'
50-
import Shared from '../model/shared.model'
51-
52-
const models = { Home, Shared }
53-
54-
export const { useStore } = Model(models)
55-
```
56-
5735
### useStore
5836

5937
The functional component in React 16.7 can use Hooks to connect the global store.
@@ -102,7 +80,7 @@ type ActionsParamType = {
10280
get: undefined
10381
} // You only need to tag the type of params here !
10482

105-
const Model = {
83+
const Model: ModelType<StateType, ActionsParamType> = {
10684
actions: {
10785
increment: async (state, _, params) => {
10886
return {
@@ -133,7 +111,7 @@ const Model = {
133111
}
134112
},
135113
state: initialState
136-
} as ModelType<StateType, ActionsParamType> // The Modal actions type will generate automatically by the StateType and ActionParamsType
114+
}
137115

138116
export default Model
139117

@@ -205,7 +183,7 @@ JavaScript Example
205183
const Model = {
206184
actions: {
207185
increment: async (s, _, params) => {
208-
return (state: typeof s) => {
186+
return state => {
209187
state.counter += params || 1
210188
}
211189
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-modelx",
3-
"version": "1.0.6",
3+
"version": "1.1.0",
44
"description": "The State management library for React",
55
"main": "./dist/index",
66
"module": "./dist/index",

0 commit comments

Comments
 (0)