by Christophe Rosset / @topheman
parisjs meetup - jan 2016
Even on a side project,
act with the same kind of constraints as on a bigger project
(~ real life usecase ...)
npm
/ webpack
/ gulp
)mocha
/ jsdom
)protractor
/ jasmine
)Babel
+ webpack
)SASS
+ webpack
)eslint
+ eslint-config-airbnb
)webpack
+ *
)webpack
+ *
)react
redux
react-router
/ redux-router
redux-thunk
redux-devtools
Demo: Setup / Launch
$ git clone https://github.com/topheman/react-es6-redux.git $ cd react-es6-redux $ npm install $ npm run webpack-dev-simple
before starting ?... Redux in 20 lines
import { createStore } from 'redux';
const store = createStore((state = 0, action) => {
switch (action.type) {
case 'INCREMENT':
return state + 1;
default:
return state;
}
});
store.subscribe(() => console.log(store.getState()));
store.dispatch({type: 'INCREMENT'});
store.dispatch({type: 'INCREMENT'});
store.dispatch({type: 'INCREMENT'});
store.dispatch({type: 'INCREMENT'});
store.dispatch({type: 'INCREMENT'});
// outputs 1, 2, 3, 4, 5
npm run webpack-mock
Used in tests to provide fixtures to http client
Homemade, combining:
nock
(to record http requests)super-agent-mocker
react-router-redux
redux-simple-router
)redux.js.org - github.com/rackt
Christophe Rosset - @topheman