You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ enum AppAction: Action {
56
56
Your reducer needs to respond to these different actions, that can be done by switching over the value of action:
57
57
58
58
```swift
59
-
let appReducer=Reducer<AppState> { action, state in
59
+
let appReducer: Reducer<AppState>= { action, state in
60
60
switch action as? AppAction {
61
61
case .Increase?:
62
62
state.counter+=1
@@ -69,7 +69,7 @@ let appReducer = Reducer<AppState> { action, state in
69
69
}
70
70
```
71
71
72
-
A single `Reducer` should only deal with a single field of the state struct. You can chain together multiple reducers using `Reducer(firstReducer, secondReducer, ...)`.
72
+
A single `Reducer` should only deal with a single field of the state struct. You can nest multiple reducers within your main reducer to provide separation of concerns.
73
73
74
74
In order to have a predictable app state, it is important that the reducer is always free of side effects, it receives the current app state and an action and returns the new app state.
0 commit comments