Created
October 2, 2017 06:47
-
-
Save ysfzrn/feff06ff91cc41dc878add6cb499c5c1 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 mobx, { observable, action } from "mobx"; | |
class Store { | |
@observable todos=[]; | |
@observable selectedStatus="all"; | |
@action('adding todo item') | |
addTodo(todo){ | |
this.todos.push({ | |
id: this.todos[this.todos.length - 1].id +1, | |
status: false, | |
text: todo | |
}) | |
} | |
@action('Selected status changed') | |
statusChange(status){ | |
this.selectedStatus = status; | |
} | |
} | |
const todoStore = new Store() | |
export default todoStore; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment