Seems the response is not an object and by adding the curly braces you create an object from an array.
Please check the response in DevTools to see what you get from the server.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
when trying to remove the curly brace it does not work.
axios.get('/api/tours')
.then(({response}) => {
this.tours = response.data;
}
);
why do we need to wrap the "response" in a curly brace?
The {} are destructing the object and giving you back the objects data property as s data variable.
If you do
.then((response) => {
console.log(response);
});
You should see an object with a data key in dev tools. You can see the response schema in the axios docs where you can see you get a data property.
Please or to participate in this conversation.