unmount 관련 질문
Notification.jsximport React from "react"; const styles = { wrapper: { margin: 8, padding: 8, display: "flex", flexDirection: "row", border: "1px solid grey", borderRadius: 16, }, messageText: { color: "black", fontSize: 16, }, }; class Notification extends React.Component { constructor(props) { super(props); this.state = {}; } componentDidMount() { console.log(`${this.props.id} componentDidMount()`); } componentDidUpdate() { console.log(`${this.props.id} componentDidUpdate()`) } componentWillUnmount() { console.log(`${this.props.id} componentWillUnmount()`) } render() { return ( {this.props.message} ) } } export default Notification;NotificationList.jsximport React from "react"; import Notification from "./Notification"; const reservedNotifications = [ { id: 1, message: "안녕하세요, 오늘 일정을 알려드립니다.", }, { id: 2, message: "점심식사 시간입니다.", }, { id: 3, message: "이제 곧 미팅이 시작됩니다.", }, ]; var timer; class NotificationList extends React.Component { constructor(props) { super(props); this.state = { notifications: [], } } componentDidMount() { const {notifications} = this.state; timer = setInterval(() => { if (notifications.length {this.state.notifications.map((notification) => { return ( ); })} ); } } export default NotificationList