分享至
我知道useState是用
let [arr, setArr] = useState(["user1", "user2"]) let nextItem = "user3" setArr(prop=>[ ...prop, nexItem ])
但是刪除要如何使用
已邀請的邦友 {{ invite_list.length }}/5
let [arr, setArr] = useState(["user1", "user2"])let toRemove = "user2";
arr = arr.filter(function(item) {return item !== toRemove});setArr([arr ]);
IT邦幫忙