Skip to content

Commit

Permalink
add referee icon for mölkky illustration of reducer
Browse files Browse the repository at this point in the history
  • Loading branch information
euZebe committed May 23, 2018
1 parent 9d602d1 commit 5caa4bb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions talk/resources/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,8 @@ Note: action = Objet { joueur, quilles tombées }
~~~
### reducer
![throw](resources/gears.png)<!-- .element: class="slide-icon" -->
fonction pure
```
reducer: (previousScore, action) => nextScore
```
![action](resources/referee.png) <!-- .element class="no-border-image" -->


~~~
### listeners
Expand Down Expand Up @@ -334,8 +332,7 @@ Note: le but n'est pas de dire que que redux est mieux ou moins bien que telle o
## Bonnes pratiques

~~~
##### le _store_ qui murmurait
##### à l'oreille des _listeners_
##### Pourquoi l'immutabilité ?
📄 <!-- .element: class="slide-icon" -->
- listeners notifiés à chaque action dispatchée
Expand Down Expand Up @@ -643,9 +640,15 @@ Note: Débat non tranché
```javascript
(dispatch, getState) => {}
```
- accès au state <!-- .element: class="fragment" -->
- multiples dispatch possibles <!-- .element: class="fragment" -->
- appels asynchrones possibles (Promise.then(dispatch).catch(dispatch)) <!-- .element: class="fragment" -->
- accès au state avant / après dispatch
- multiples dispatch
- appels asynchrones
```javascript
Promise.then(
dispatch(successAction),
dispatch(failureAction)
)
```
~~~
Expand Down Expand Up @@ -677,12 +680,12 @@ function fetchArticles() {
dispatch(startFetchingArticles());

fetchData()
.then(data => {
dispatch(fetchArticlesSuccess(data));
})
.catch(err => {
dispatch(fetchArticlesError(err.message));
});
.then(
// success
data => dispatch(fetchArticlesSuccess(data)),
// failure
() => dispatch(fetchArticlesError(err.message))
});
}
}
```
Expand Down
Binary file added talk/resources/referee.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5caa4bb

Please sign in to comment.