From 64bd766619146f19d0c8aaa44e3b10b4ab3fc5de Mon Sep 17 00:00:00 2001 From: Ken Chau Date: Sat, 16 Feb 2019 17:06:30 -0800 Subject: [PATCH] adding some comments about devtool hook up --- .vscode/settings.json | 1 + step2-06/src/index.tsx | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 2a172a9..75ef25b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,6 @@ "prettier.printWidth": 140, "prettier.tabWidth": 2, "prettier.singleQuote": true, + "editor.tabSize": 2, "editor.formatOnSave": true } diff --git a/step2-06/src/index.tsx b/step2-06/src/index.tsx index dca8b6b..56f4eab 100644 --- a/step2-06/src/index.tsx +++ b/step2-06/src/index.tsx @@ -2,10 +2,14 @@ import { reducer } from './reducers'; import { createStore, compose } from 'redux'; import { addTodo } 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 = createStore(reducer, {}, composeEnhancers()); +const store = createStoreWithDevTool(reducer, {}); console.log(store.getState());