Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/lake2/imdux
Browse files Browse the repository at this point in the history
  • Loading branch information
lake2 committed Jul 10, 2020
2 parents 78fd460 + dd669c1 commit 4944d0a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Expand Up @@ -48,8 +48,10 @@ yarn add imdux immer redux react-redux
└── yarn.lock
```


打开`src/store/counter.reducers.js`,输入代码:


```js
import { createAction } from "imdux";

Expand All @@ -69,8 +71,10 @@ const reducers = {
export const counter = createAction({ initialState, reducers });
```


打开`src/store/index.js`,创建一个store:


```js
import { createStore } from "imdux";

Expand All @@ -80,8 +84,10 @@ export const store = createStore({ counter }, { devtool: true });
export const { Dispatch, Query } = store;
```


打开`src/App.js`,创建一个`App`


```js
import React from "react";
import { useSelector } from "react-redux";
Expand All @@ -101,8 +107,10 @@ export function App() {
}
```


最后,打开`src/index.js`,注入redux的store:


```js
import React from "react";
import ReactDOM from "react-dom";
Expand Down

0 comments on commit 4944d0a

Please sign in to comment.