I am trying with MobX. My questions are
- Does MobX come with a built http piece? If yes what is the name/function?
- If the answer to #1 is no and I use axios how can I convert the resolved promise to my observable?
I know the following is incorrect. What is the common way to achieve this?
export class TodoStore {
@observable todos = [];
....
fetchTodo() {
axios.get("http://rest.learncode.academy/api/reacttest/tweets")
.then((response) => {
response.data.map(item => {
this.todos.push(new Todo(item));
})
.catch((err) => {
....
});
});
}
}