JSFiddle - React, Tailwind, and code Playground
Babel + JSX
fetchCustomers() {
axios.get('/customers')
.then(res => {
// log API response to console
console.log(res);
//save customer data to customer data instance
this.customers = res;
// cache response to localstorage
window.localStorage.setItem('customersList', JSON.stringify(res));
})
.catch(err => {
// log errors to console
console.error(err);
})
}