I was following Mosh's react native course when I ran into this problem after trying to delete item from a flatlist using the useState hook it doesn't rerender is there any thing wrong in this code or this is some sort of bug I have I would really appreciate the help this is my code and I'm using handleDelete as an onPress event:
const [messages, setMessages] = useState(initialMessages);
const handleDelete = (message) => {
setMessages(messages.filter(m => m.id != message.id));
}
Via Active questions tagged javascript - Stack Overflow https://ift.tt/XYsceB0
Comments
Post a Comment