Loading Items
Goals
Resumen
Pasos
Step 1
ListStore.loadItems()React.render(<CreationForm />, document.getElementById('form-container') ) React.render(<List />, document.getElementById('list-container') ) ListStore.loadItems() </script> </body>Step 2
loadItems: function() { var loadRequest = $.ajax({ type: 'GET', url: "https://listalous.herokuapp.com/lists/YOUR-LIST-NAME-HERE/" }) },Step 3
loadRequest.done(function(dataFromServer) { items = dataFromServer.items notifyComponents() })
Explicación
ListStore = {
getItems: function() {
return items
},
loadItems: function() {
var loadRequest = $.ajax({
type: 'GET',
url: "https://listalous.herokuapp.com/lists/YOUR-LIST-NAME-HERE/"
})
loadRequest.done(function(dataFromServer) {
items = dataFromServer.items
notifyComponents()
})
},
addItem: function(itemDescription) {},
toggleCompleteness: function(itemId) {}
Next Step:
Go on to Adding An Item