Replacing dummy items
In the last lesson, we've used fetch to send an AJAX request to the API.
We can see the response is an array of product objects, so in this video we'll get those into our Vue app state so that we can use them in the app.
Loading products
The first thing we'll do is delete the dummy items from the products
array, as we won't need those anymore. So now, products
will be initialized with an empty array.
public/script.js
Vue.createApp({
data() {
Click to load comments...