fetchData = async () => {
try {
const response = await fetch(`https://........`);
const data = (await response.json()).group;
this.setState({
data: data,
car: Object.keys(data)[0]
},this.filter);
} catch(err) {
console.log("404 Not Found");
}
};
const fetchData = () => {
fetch('...')
.then(response => response.json())
.then(({ group }) => {
this.setState({
data: group,
car: Object.keys(group)[0]
}, this.filter);
})
.catch(error => {
console.log('404 Not Found');
});
};
fetchData = () => {
fetch(`https://........`)
.then((response) => response.json())
.then((data) => {
const groupedData = data.group;
this.setState({
data: groupedData,
car: Object.keys(groupedData)[0]
}, this.filter);
})
.catch(() => {
console.log("404 Not Found");
});
};