Last active
May 22, 2018 13:25
-
-
Save scottdomes/7dea7c4994c848f6bb18decf329fb2d3 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
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