Skip to content

Instantly share code, notes, and snippets.

@bradfordlemley
Last active May 24, 2019 17:32
Show Gist options
  • Save bradfordlemley/914a110287469b5e78380a6666529601 to your computer and use it in GitHub Desktop.
Save bradfordlemley/914a110287469b5e78380a6666529601 to your computer and use it in GitHub Desktop.
Counter using base stated library
import createBase from './StatedLibBase';
export default function createCounter() {
let base = createBase(0);
return {
get state() { return base.state },
state$: base.state$,
increment() { base.setState(base.state + 1) },
decrement() { base.setState(base.state - 1) },
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment