📌  相关文章
📜  useeffect 将卸载 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:12.736000             🧑  作者: Mango

代码示例6
useEffect(() => {
    messagesRef.on('child added', snapshot => {
    const message = snapshot.val();
    message.key = snapshot.key;

    setMessages(messages.concat(message)); // See Note 1
}, []); // See Note 2