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
>Simple Stupid Redux Store using Reactive Extensions
15
16
@@ -23,12 +24,12 @@ You can follow this link: https://www.microsoft.com/store/apps/9PDBXGFZCVMS
23
24
24
25
##Getting started
25
26
26
-
Like the original Redux library, you will have to initialize a new`State` when creating a`Store` + you will create`Reducer` functions each linked to an`Action` which will possibly update this`State`.
27
+
Like the original Redux library, you will have to initialize a new`State` when creating a`Store` + you will create`Reducer` functions each linked to an`Action` which will possibly update this`State`.
27
28
28
29
In your app, you can:
29
30
30
-
*`Dispatch` new`Action` to change the`State`
31
-
* and listen to events/changes using the`Subscribe` method
31
+
-`Dispatch` new`Action` to change the`State`
32
+
- and listen to events/changes using the`Subscribe` method
32
33
33
34
You will need to follow the following steps to create your own Redux Store:
@@ -183,9 +185,9 @@ Sub-reducers also known as feature reducers are nested reducers that are used to
183
185
184
186
The`CreateSubReducers` function helps you to create sub-reducers. This function has a few requirements:
185
187
186
-
* a`Selector` - to be able to access the value of the current nested state
187
-
* a`Reducer` - to explicitly detail how to update the parent state given a new value for the nested state
188
-
* and the list of reducers using`On` pattern
188
+
- a`Selector` - to be able to access the value of the current nested state
189
+
- a`Reducer` - to explicitly detail how to update the parent state given a new value for the nested state
190
+
- and the list of reducers using`On` pattern
189
191
190
192
First you need to create a new state lens for feature/nested states:
191
193
@@ -230,7 +232,7 @@ Remember that following this pattern, you can have an infinite number of layers
230
232
231
233
Based on what you need, you can observe the entire state or just a part of it.
232
234
233
-
Note that every selector is a*memoized selector* by design, which means that a next value will only be subscribed if there is a difference with the previous value.
235
+
Note that every selector is a_memoized selector_ by design, which means that a next value will only be subscribed if there is a difference with the previous value.
Simple selectors are like functions but the main benefits are that they can be reused in multiple components and they can be reused to create other selectors.
261
+
Simple selectors are like functions but the main benefits are that they can be reused in multiple components and they can be reused to create other selectors.
@@ -333,9 +335,9 @@ Side effects are functions that runs outside of the predictable State -> UI cycl
333
335
334
336
When you work with asynchronous tasks (side effects), you can follow the following rule:
335
337
336
-
* Create 3 actions - a start action, a`fulfilled` action and a`failed` action
337
-
* Reduce/Handle response on`fulfilled` action
338
-
* Reduce/Handle error on`failed` action
338
+
- Create 3 actions - a start action, a`fulfilled` action and a`failed` action
339
+
- Reduce/Handle response on`fulfilled` action
340
+
- Reduce/Handle error on`failed` action
339
341
340
342
Here is a concrete example.
341
343
@@ -365,14 +367,14 @@ public static Effect<RootState> GetTodos = CreateEffect<RootState>(
365
367
()=>Store.ObserveAction<GetTodosAction>()
366
368
.Select(_=>_todoApi.GetTodos())
367
369
.Switch()
368
-
.Select(todos=>
370
+
.Select(todos=>
369
371
{
370
372
returnnewGetTodosFulfilledAction
371
373
{
372
374
Todos=todos.ToImmutableList()
373
375
};
374
376
})
375
-
.Catch(e=>
377
+
.Catch(e=>
376
378
{
377
379
returnObservable.Return(
378
380
newGetTodosFailedAction
@@ -434,14 +436,14 @@ It will then fires an `UndoneAction` event you can subscribe to.
434
436
Store.Select()
435
437
.Subscribe(_=>
436
438
{
437
-
// TODO : Handle event when the State changed
439
+
// TODO : Handle event when the State changed
438
440
// You can observe the previous state generated or...
439
441
});
440
442
441
443
Store.ObserveUndoneAction()
442
444
.Subscribe(_=>
443
445
{
444
-
// TODO : Handle event when an Undo event is triggered
446
+
// TODO : Handle event when an Undo event is triggered
445
447
// ...or you can observe actions undone
446
448
});
447
449
```
@@ -512,7 +514,7 @@ You can then handle the reset event on your application.
512
514
Store.ObserveReset()
513
515
.Subscribe(_=>
514
516
{
515
-
// TODO : Handle event when the Store is reset
517
+
// TODO : Handle event when the Store is reset
516
518
// (example: flush navigation history and restart from login page)
517
519
});
518
520
```
@@ -525,7 +527,7 @@ Store.ObserveReset()
525
527
526
528
When dealing with entities, you often repeat the same process to add, update and remove entity from your collection state. With the`ReduxSimple.Entity` package, you can simplify the management of entities using the following pattern:
527
529
528
-
1. Start creating an`EntityState` and an`EntityAdapter`
530
+
1. Start creating an`EntityState` and an`EntityAdapter`