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
***Actions:** The way creating and registering action has been changed. Instead of declaring action as class, you can create them via`createAction` function. (It is changed since modifying uglify settings for a library does not make sense and it is more compatible with FSA standards.)
2
6
7
+
###Features
8
+
9
+
***mapDispatchToProps:** This new method can be used for mapping actions to props in easy way. You can find the usage in readme.
***AsyncAction:** There is no more`AsyncAction`. Instead of passing dispatch through actions, it is passing to reducer body. You can use async dispatch on reducer declaration via`ReducerBuilder`.
7
16
8
-
***ReducerBuilder.build():** Dont need to build reducer, only passing declaration is enough.
17
+
***ReducerBuilder.build():** Dont need to build reducer, only passing declaration is enough.
###FOR v 2.X PLEASE GO TO[THE 2.x BRANCH](https://github.com/cimdalli/redux-ts/tree/2.x)
10
+
<h5align="right"> Now FSA compliant</h5>
9
11
10
12
>For breaking changes you can take look[CHANGELOG](./CHANGELOG.md)
11
13
@@ -30,62 +32,65 @@ const store = new StoreBuilder<StoreState>()
30
32
31
33
##Actions
32
34
33
-
Actions store data that are required on reducers. Declaration of them are succeed by their`class name` so no need to define type again.
34
-
35
-
>Uglify operation will scramble function names so you need to either configure to keep function names as is ([#1](https://github.com/cimdalli/redux-ts/issues/1)) or specify unique names with`type` property.
35
+
Action declaration can be done with`'createAction'` function which takes action`type` as parameter.
Reducers are consumers for actions to change application state. Difference from original redux implementation is in`redux-ts` reducers can also dispatch another action asynchronously. Each reducer method should returna value even it doesn't changestate. Async dispatch operations will be handled after original dispatch cycle is finished.
58
+
Reducers are consumers for actions to change application state. Difference from original redux implementation is in`redux-ts` reducers can also dispatch another action asynchronously. Each reducer method should returnstate value even it doesn't changeit. Async dispatch operations will be handled after original dispatch cycle is finished.
* When server respond with token, another action is dispatching.
84
+
*/
85
+
dispatch(SetToken(data.token))
81
86
dispatch(push('/dashboard'))
82
87
})
83
88
84
89
returnstate
85
90
})
86
91
87
92
.handle(Logout, (state,action,dispatch)=> {
88
-
dispatch(newSetToken(undefined))
93
+
dispatch(SetToken({ token:undefined }))
89
94
dispatch(push('/dashboard'))
90
95
91
96
returnstate
@@ -108,9 +113,47 @@ export const authReducer = new ReducerBuilder<AuthState>()
108
113
})
109
114
```
110
115
116
+
##Connect
117
+
118
+
`connect` method is part of redux library and allows you to connect your react components with redux store. Although you can use your own implementation, this library provides you some syntactic sugar to make it easy.