Skip to content

Instantly share code, notes, and snippets.

@shanebdavis
Last active December 28, 2019 21:42
Show Gist options
  • Save shanebdavis/a79541a63d10fc4dadfc856eeab582b3 to your computer and use it in GitHub Desktop.
Save shanebdavis/a79541a63d10fc4dadfc856eeab582b3 to your computer and use it in GitHub Desktop.
modular-redux-tutorial list part 2 - helpers
// HELPERS
const getState = () => store.getState()[storeKey];
const subscribe = f => {
let lastState = getState();
return store.subscribe(
() => lastState !== getState() && f((lastState = getState()))
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment