Skip to content

Commit

Permalink
reactotron導入
Browse files Browse the repository at this point in the history
  • Loading branch information
Shota Matsushita committed Nov 23, 2016
1 parent 685a50e commit aef4bf2
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
9 changes: 9 additions & 0 deletions App/Config/Reactotron.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Reactotron from 'reactotron-react-js';
import { reactotronRedux } from 'reactotron-redux';
import sagaPlugin from 'reactotron-redux-saga';

export default Reactotron
.configure({ name: 'difftron connect' })
.use(reactotronRedux())
.use(sagaPlugin())
.connect();
8 changes: 5 additions & 3 deletions App/Stores/Store.development.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { createStore, applyMiddleware, compose } from 'redux';
import { applyMiddleware, compose } from 'redux';
import createSagaMiddleware from 'redux-saga';
import { autoRehydrate } from 'redux-persist';
import rootReducer from '../Reducers/';
import sagas from '../Sagas/';
import persistTransform from '../Services/ImmutablePersistenceTransform';
import Reactotron from '../Config/Reactotron';

const middleware = [];
const sagaMiddleware = createSagaMiddleware();
const sagaMonitor = Reactotron.createSagaMonitor();
const sagaMiddleware = createSagaMiddleware({ sagaMonitor });
middleware.push(sagaMiddleware);

const enhancers = [];
Expand All @@ -17,7 +19,7 @@ export default () => {
enhancers.push(autoRehydrate());

// Store生成
const store = createStore(rootReducer, compose(...enhancers));
const store = Reactotron.createStore(rootReducer, compose(...enhancers));
// state永続化設定
persistTransform(store);

Expand Down
28 changes: 28 additions & 0 deletions App/Stores/Store.production.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { createStore, applyMiddleware, compose } from 'redux';
import createSagaMiddleware from 'redux-saga';
import { autoRehydrate } from 'redux-persist';
import rootReducer from '../Reducers/';
import sagas from '../Sagas/';
import persistTransform from '../Services/ImmutablePersistenceTransform';

const middleware = [];
const sagaMiddleware = createSagaMiddleware();
middleware.push(sagaMiddleware);

const enhancers = [];

// createStore
export default () => {
enhancers.push(applyMiddleware(...middleware));
enhancers.push(autoRehydrate());

// Store生成
const store = createStore(rootReducer, compose(...enhancers));
// state永続化設定
persistTransform(store);

// run sagas
sagaMiddleware.run(sagas);

return store;
};
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
"extract-text-webpack-plugin": "^1.0.1",
"nyc": "^10.0.0",
"proxyquire": "^1.7.10",
"reactotron-react-js": "^1.5.2",
"reactotron-redux": "^1.5.2",
"reactotron-redux-saga": "^1.5.2",
"style-loader": "^0.13.1",
"webpack": "^1.13.2",
"webpack-dev-middleware": "^1.8.4",
Expand Down

0 comments on commit aef4bf2

Please sign in to comment.