You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importthrottlefrom'lodash/throttle'constpersistedState=loadState();conststore=createStore(todoAppReducer,persistedState// initial state of store);constsaveStateFunc=()=>{saveState({todos: store.getState().todos})}// inner function isn't called more often than the duration milisecondsstore.subscribe(throttle(saveStateFunc,1000))
import{v4}from'node-uuid'// Bir action objesiexportconsttodo=(text)=>({type: 'ADD_TODO',id: v4(),
text // text: text})
import{v4}from'node-uuid'// Bir action objesiexportconsttodo=(text)=>({type: 'ADD_TODO',id: v4(),
text // text: text})
Store Dispatch metoduna Logging Özelliği eklemek
constaddLoggingToDispatch=(store)=>{constrawDispatch=store.dispatch;return(action)=>{console.group(action.type);console.log('%c prev state','color: gray',store.getState());console.log('%c action','color: blue',action);constreturnValue=rawDispatch(action);console.log('%c next state','color: green',store.getState());console.groupEnd(action.type);returnreturnValue;}}constconfigureStore=()=>{constpersistedState=loadState();conststore=createStore(todoApp,persistedState);if(process.env.NODE_ENV!=='production'){store.dispatch=addLoggingToDispatch(store);}
...