I am just starting to learn react. As of now I am feeding some hard-coded data in my application which I want to get it replaced by some external api and load data accordingly. Here's what I have done so far.
import axios from "axios";
class TodoStore extends EventEmitter{
constructor() {
super();
this.todos = [
{
id: 123,
text: "Go Shopping",
complete: false
},
{
id: 456,
text: "Pay Bills",
complete: false
}
];
}
getAll(){
return this.todos;
}
Now what I want to do is I want to implement https://jsonplaceholder.typicode.com/todos and assign all the returned results in my todos. So, what would be the proper way to do so? Any help will be appreciated.