【发布时间】:2021-07-15 00:30:35
【问题描述】:
我的问题是,当我调用函数 getAllFlashCardsFromQuest() 时,它会调用所有页面中创建的所有闪存卡,我只想要来自特定路径名的对象,或者过滤卡片数组的方法。
async function getCards() {
let cardsValues = await getAllFlashCardsFromQuest() as FlashCard[]
let cardsFiltered = cardsValues.filter(()=>{
return history.location.pathname === 'CriarAlternativaQuest'
})
console.log(cardsFiltered)
setCards(cardsFiltered)
}
【问题讨论】:
标签: reactjs location history pathname