Last active
June 15, 2017 11:27
-
-
Save vitalipe/2e1e8c7d3df3877b2cfc4e6a7afe796e to your computer and use it in GitHub Desktop.
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
| var state = mobx.observable({ | |
| todos : [], | |
| visibilityFilter : "ALL", | |
| addTodoItem : action(function (text, completed) { | |
| this.todos.push({text, completed}) | |
| }), | |
| setVisibilityFilter : action(function (filter) { | |
| this.visibilityFilter = filter; | |
| }) | |
| }); |
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
| (def state (r/atom { | |
| :todos [] | |
| :visibility-filter :all})) | |
| (defn add-todo-item [text completed] | |
| (swap! state update-in [:todos] conj {:text text :completed completed})) | |
| (defn set-visibility-filter [filter] | |
| (swap! state assoc :visibility-filter filter)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment