Last active
March 9, 2018 15:59
-
-
Save andrejewski/3ac10b7704ccd716ba3fd4431be6a1b2 to your computer and use it in GitHub Desktop.
Sample of raj-can-map
This file contains hidden or 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 { program } from 'https://gist.github.com/andrejewski/5455ccdef77122389b1ac8a7b5ff8415' | |
| // Functional | Reductionist | |
| program(DefineMap, () => ({ | |
| init: [{ | |
| name: '', | |
| nameChangeCount: 0 | |
| }], | |
| update: (msg, model) => [{ | |
| name: msg, | |
| nameChangeCount: model.nameChangeCount + 1 | |
| }], | |
| view: (model, dispatch) => ({ | |
| name: model.name, | |
| setName: dispatch | |
| }) | |
| })) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment