Skip to content

Instantly share code, notes, and snippets.

@scottdomes
Last active May 22, 2018 13:25
Show Gist options
  • Save scottdomes/7dea7c4994c848f6bb18decf329fb2d3 to your computer and use it in GitHub Desktop.
Save scottdomes/7dea7c4994c848f6bb18decf329fb2d3 to your computer and use it in GitHub Desktop.
import { observable } from 'mobx'
class ContactStore {
@observable contacts = []
load() {
fetch(API_URL + '/contacts')
.then(data => {
const list = data.contacts.map(contactData => {
return new Contact(contactData)
})
this.contacts.replace(list)
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment