这是sectionlist data的get api
const getAllMatches = async () =>{
await fetch(APIS?.Matches, {
method: 'GET',
headers: {
Authorization: user,
Accept: 'application/json',
'Content-Type': 'application/json',
},
})
.then(response => response.json())
.then(({matches}) => {
setAllMatches(matches);
})
.catch(error => {
return console.error(error);
});
};
仅在您的代码中设置匹配时使用:
setAllMatches(matches.filter((item,index)=>item.category=="fruits");
在本例中,我们将匹配类别水果,您可以相应地调整