Skip to content
Permalink
Browse files

6. Redux 선물 - 시간여행과 로깅기능

  • Loading branch information
egoing committed May 5, 2019
1 parent 159f5ff commit bb107bbff2cbb05971fb92ecff00b0ad04ec82d2
Showing with 5 additions and 2 deletions.
  1. +5 −2 with-redux.html
@@ -17,17 +17,20 @@
<div id="green"></div>
<script>
function reducer(state, action){
console.log(state, action);
if(state === undefined){
return {color:'yellow'}
}
var newState;
if(action.type === 'CHANGE_COLOR'){
newState = Object.assign({}, state, {color:action.color});
}
console.log(action.type, action, state, newState);
return newState;
}
var store = Redux.createStore(reducer);
var store = Redux.createStore(
reducer,
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
);
function red() {
var state = store.getState();
document.querySelector('#red').innerHTML = `

0 comments on commit bb107bb

Please sign in to comment.
You can’t perform that action at this time.