diff --git a/dist/index.html b/dist/index.html index a15d4e1..b62c7f4 100644 --- a/dist/index.html +++ b/dist/index.html @@ -39,9 +39,9 @@
- - + + diff --git a/src/index.js b/src/index.js index 7555e96..6758faa 100644 --- a/src/index.js +++ b/src/index.js @@ -3,6 +3,27 @@ import ReactDOM from 'react-dom' import React from 'react' import { Root } from './app.jsx' + +import { createStore, applyMiddleware } from 'redux' +import logger from 'redux-logger' + + + +function reducer(state = {}, action) { + switch (action.type) { + case 'toggle': + return { ...state, toggle: action.payload } + case 'rx-new-sketch': + return { ...state, sketches: [...state.sketches, action.idx] } + default: + return state + } +} + +window.store = createStore(reducer, {sketches:[]}, applyMiddleware(logger)) + + + document.addEventListener('DOMContentLoaded', () => { ReactDOM.render( React.createElement(Root, { store: store }, null) diff --git a/src/redux.js b/src/redux.js deleted file mode 100644 index 1dd0603..0000000 --- a/src/redux.js +++ /dev/null @@ -1,18 +0,0 @@ - -import { createStore, applyMiddleware } from 'redux' -import logger from 'redux-logger' - - - -function reducer(state = {}, action) { - switch (action.type) { - case 'toggle': - return { ...state, toggle: action.payload } - case 'rx-new-sketch': - return { ...state, sketches: [...state.sketches, action.idx] } - default: - return state - } -} - -window.store = createStore(reducer, {sketches:[]}, applyMiddleware(logger))