const data = [
{ id: 1, name: Mike, city: philps, state: New York },
{ id: 2, name: Steve, city: Square, state: Chicago },
{ id: 3, name: Jhon, city: market, state: New York },
{ id: 4, name: philps, city: booket, state: Texas },
{ id: 5, name: smith, city: brookfield, state: Florida },
{ id: 6, name: Broom, city: old street, state: Florida },
]
const tags = [
{ state: New York },
{ state: Texas },
{ state: Florida },
]
const [tags, setTgas] = useState(tags)
onChange={(e) => {
setTgas([...tags,{state: new_tag},]);
}
我怎样才能得到数据通过过滤使用多个标签?如果我删除和添加标签数据将显示相应的标签和是有是没有标签所有数据将显示.
3条答案
按热度按时间e0bqpujr1#
可以使用数组筛选器
chhkpiq42#
我希望您添加和删除标签的逻辑已经按预期工作。在此基础上,您的要求可以通过以下操作来满足:
4jb9z9bj3#