import {createStore} from 'redux'; import app from 'app/redux/reducers'; export const store = createStore(app, {}); export const observeStore = (store, select, onChange) => { let currentState; const handleChange = () => { let nextState = select(store.getState()); if (nextState !== currentState) { currentState = nextState; onChange(currentState); } }; const unsubscribe = store.subscribe(handleChange); handleChange(); return unsubscribe; };