Created
December 3, 2017 16:38
-
-
Save sslotsky/f7737847ad0a7818ce7cdc3e537867fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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