Skip to content

Instantly share code, notes, and snippets.

@sslotsky
Created December 3, 2017 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sslotsky/f7737847ad0a7818ce7cdc3e537867fd to your computer and use it in GitHub Desktop.
Save sslotsky/f7737847ad0a7818ce7cdc3e537867fd to your computer and use it in GitHub Desktop.
import { initialize, split } from "apothecary";
import { tunnel, fromProps } from "react-apothecary";
const store = initialize({ n: 1 });
const increment = step => split(n => n + step, "n");
const decrement = step => split(n => n - step, "n");
...
const CounterApp = tunnel(
(state, props) => {
return { n: state.n + props.offset };
}, {
inc: increment(4),
dec: decrement(4)
}
)(Counter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment