Update redux.md
This commit is contained in:
parent
a0bdfe2dd0
commit
2a0855a494
17
redux.md
17
redux.md
|
@ -26,13 +26,6 @@ function counter (state = { value: 0 }, action) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
### Combine Reducers
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Combine Reducers into one whole Reducer with combineReducers function
|
|
||||||
const counterApp = combineReducers({counter,otherReducer,anotherReducer});
|
|
||||||
// You can list down reducers here and thanks to ES6 Object literal, we have to only pass key(if key and value are same).
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
let store = createStore(counter)
|
let store = createStore(counter)
|
||||||
|
@ -144,6 +137,16 @@ export default connect(
|
||||||
|
|
||||||
Same as above, but shorter.
|
Same as above, but shorter.
|
||||||
|
|
||||||
|
### Combining reducers
|
||||||
|
|
||||||
|
```js
|
||||||
|
const reducer = combineReducers({
|
||||||
|
counter, user, store
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
Combines multiple reducers into one reducer function. See: [combineReducers](https://redux.js.org/docs/api/combineReducers.html) _(redux.js.org)_
|
||||||
|
|
||||||
## Middleware
|
## Middleware
|
||||||
|
|
||||||
### Signature
|
### Signature
|
||||||
|
|
Loading…
Reference in New Issue