Last active
August 15, 2017 13:28
-
-
Save vdsabev/762f7f1a36aabd8401fec6eed54728e4 to your computer and use it in GitHub Desktop.
Exploring Unidirectional Components in Mithril
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
const Counter = component({ | |
state: { | |
count: 0 | |
}, | |
actions: { | |
decrement: ({ count }) => ({ count: count - 1 }), | |
increment: ({ count }) => ({ count: count + 1 }) | |
}, | |
view: ({ count }, { decrement, increment }) => <div>...</div> | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment