I have this code snippet:
export default defineComponent({
name: "filter",
props: {},
setup() {
const states = useCounterStore();
return { states };
},
data() {
return {
items: [],
};
},
methods: {},
mounted() {
fetch("http://localhost:3000/tags")
.then((res) => res.json())
.then((data) => {
this.items = data;
alert(data);
})
.catch((err) => console.log(err.message));
},
});
The fetch gets called twice, and I don't know why. Is there any solution for this?