Skip to content

Instantly share code, notes, and snippets.

@ysfzrn
Created October 2, 2017 06:47
Show Gist options
  • Save ysfzrn/feff06ff91cc41dc878add6cb499c5c1 to your computer and use it in GitHub Desktop.
Save ysfzrn/feff06ff91cc41dc878add6cb499c5c1 to your computer and use it in GitHub Desktop.
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