Skip to content

Commit

Permalink
clearer names in code examples
Browse files Browse the repository at this point in the history
  • Loading branch information
euZebe committed May 22, 2018
1 parent bbdd905 commit 5a108e5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/molkky-vanilla-redux.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ function rootReducer(previousState = {}, action) {
};

// FIXME: unpure reducer: state mutated => audience and referee won't see the action
// state[player].score += fallenPins.length;
// state[player].consecutiveFailures = 0;
// state.fallenPins = fallenPins.length;
// return state;
previousState[player].score += fallenPins.length;
previousState[player].consecutiveFailures = 0;
previousState.fallenPins = fallenPins.length;
return previousState;

// FIXME: unpure reducer: nested state mutated => player listener won't see the action
// FIXME: !! BobListener listens modifications on Bob's substate
// const nextState = { ...state, fallenPins: fallenPins.length };
// const nextState = { ...previousState, fallenPins: fallenPins.length };
// nextState[player].consecutiveFailures = 0;
// nextState[player].score += fallenPins.length;
// return nextState;
Expand Down Expand Up @@ -165,7 +165,7 @@ const crowd = () => {
const fallenPinsOnLastThrow = nextState.fallenPins;
if (fallenPinsOnLastThrow) {
console.log('Spectateurs: 👏👏👏👏\n');
} else {
} else if (fallenPinsOnLastThrow === 0) {
console.log('Spectateurs: 😞\n');
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/store/articles.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createStore } from 'redux';
import deepFreeze from 'deep-freeze';
import { createArticle, getArticlesSortedByCreationDate, getLastModification } from './articles';
import reducers from './reducers';
import reducer from './reducers';

describe('articles duck', () => {
test('should update last modification when an article is added', () => {
const store = createStore(reducers);
const store = createStore(reducer);
const previousState = deepFreeze(store.getState());
expect(getLastModification(previousState)).toBeNull();
expect(getArticlesSortedByCreationDate(previousState)).toHaveLength(0);
Expand Down
6 changes: 3 additions & 3 deletions src/store/configureStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export default function configureStore(initialState) {
);

// if (module.hot) {
// // Enable Webpack hot module replacement for reducers
// module.hot.accept('../reducers', () => {
// const nextReducer = require('../reducers')
// // Enable Webpack hot module replacement for reducer
// module.hot.accept('../reducer', () => {
// const nextReducer = require('../reducer')
// store.replaceReducer(nextReducer)
// })
// }
Expand Down
4 changes: 4 additions & 0 deletions talk/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ section.only-image.present > p > img {
.no-border-image {
border: unset !important;
background-color: transparent !important;
}

.align-right {
text-align: right;
}
3 changes: 3 additions & 0 deletions talk/resources/content.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Redux
## bonnes pratiques
___
Jean Martineau-Figuette <!-- .element class="align-right" -->

22 mai 2018 <!-- .element class="align-right" -->
Note:
couper le téléphone

Expand Down

0 comments on commit 5a108e5

Please sign in to comment.