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
***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
+
8
+
***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/ReactiveX/rxjs/tree/2.x)
9
+
10
+
>For breaking changes you can take look[CHANGELOG](./CHANGELOG.md)
9
11
10
12
```js
11
13
npm install--save redux-ts
@@ -15,120 +17,100 @@ npm install --save redux-ts
15
17
16
18
Create redux store with builder pattern.
17
19
18
-
```js
20
+
```ts
19
21
import {StoreBuilder }from'redux-ts'
20
22
21
-
var store:Redux.Store<StoreState>=newStoreBuilder<StoreState>()
22
-
.withInitialState({test:true})
23
-
.withReducer("reducer", reducer)
24
-
.build();
25
-
}
26
-
```
27
-
28
-
>To enable*chrome redux tool*; first declare a const then register within*StoreBuilder*
29
-
30
-
```js
31
-
constdevTool= (f:Redux.StoreCreator)=> {
32
-
return ((window as any).__REDUX_DEVTOOLS_EXTENSION__)? (window as any).__REDUX_DEVTOOLS_EXTENSION__: f
23
+
const store=newStoreBuilder<StoreState>()
24
+
.withInitialState({test:true})
25
+
.withReducer("reducer",reducer)
26
+
.withDevTools()// enable chrome devtools
27
+
.build();
33
28
}
34
-
35
-
var store=newStoreBuilder<StoreState>()
36
-
.withEnhancer(devTool)
37
-
.build();
38
29
```
39
30
40
-
41
31
##Actions
42
32
43
-
Actions store data that are required on reducers. Declaration of them are succeed by their class name so no need to define type again. Depend on need, action could be either sync or async (like[redux-thunk](https://github.com/gaearon/redux-thunk)).
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.
44
34
45
-
```js
46
-
import {SyncAction,AsyncAction }from'redux-ts'
47
-
import {push }from'react-router-redux'
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.
Unlikeoriginal redux implementation,reducers canconsume both sync and async actions. Each reducer method should return a value even itdoesnt change state. Async operationsare stored on async actions andwill beresolved after original dispatch cycle isfinised.
62
+
Reducers are consumers for actions to change application state. Difference fromoriginal redux implementation is in`redux-ts`reducers canalso dispatch another action asynchronously. Each reducer method should return a value even itdoesn't change state. Asyncdispatchoperations will behandled after original dispatch cycle isfinished.