Files
frontend-bootcamp/docs/step2-06/exercise/src/index.tsx
2019-02-19 23:41:11 -08:00

20 lines
602 B
TypeScript

import { reducer } from './reducers';
import { createStore, compose } from 'redux';
import { actions } from './actions';
/* Goop for making the Redux dev tool to work */
declare var window: any;
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
function createStoreWithDevTool(reducer, initialStore) {
return createStore(reducer, initialStore, composeEnhancers());
}
const store = createStoreWithDevTool(reducer, {});
console.log(store.getState());
store.dispatch(actions.addTodo('hello'));
store.dispatch(actions.addTodo('world'));
console.log(store.getState());