강의보고 아무리 따라쳐도 안될것임.
1190
S J
4 asked
0
/**/
import React from "react";
const styles = {
wrapper: {
margin : 9,
padding : 9,
display : "flex",
flexDirection: "row",
border: "1px solid grey",
borderRadius : 15
},
messageText: {
color: "black"
,fontSize : 15
},
};
class Notification extends React.Component{
constructor(props){
super(props);
this.setState = {};
}
render(){
return(
<div style={styles.wrapper}>
<span style={styles.messageText}>{this.props.message}</span>
</div>
);
}
}
export default Notification;
/**/
import React from "react";
import Notification from "./Notification"
const reservedNotifications = [
{
message : "안녕하세요, 오늘 일정을 알려드립니다.",
},
{
message : "안녕하세요, 오늘 점심을 알려드립니다.",
},
{
message : "안녕하세요, 오늘 저녁을 알려드립니다.",
},
];
var timer ;
class NotificationList extends React.Component{
constructor(props){
super(props)
this.state = {
notificationarr : [{
message : "안녕하세요 ."
}] ,
}
}
componentDidMount(){
const { notificationarr } = this.state;
timer = setInterval(() => {
if(notificationarr && notificationarr.length < reservedNotifications.length){
const index = notificationarr.length;
console.log(index);
notificationarr.push(reservedNotifications[index]);
this.setState({
notification: notificationarr,
});
}else{
clearInterval(timer);
return;
}
}, 1000);
}
render() {
return(
<div>
{ this.state.notificationarr.map((notification) => {
return<Notification message={notification.message} />
})}
</div>
);
}
}
export default NotificationList
react
HTML/CSS
javascript
Answer 3
0
import NotificationList from './chapter_06/NotificationList';
import React from 'react';
import * as ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(<NotificationList />);
reportWebVitals();
강의가 삭제되었다고 합니다
0
106
1
이거 왜 존재하지 않는다고 뜨는건가요
0
133
1
존재하지 않는 수업이라고 떠요
0
182
1
안드로이드 에뮬레이터 오류
0
100
1
교재 구입해서 강의 들으려고 하는데 커리큘럼이 없어졌어요.
0
125
1
prevIsConfiromed 질문
1
141
2
chapter14 잘이해가 되지않습니다..
1
135
2
2025년 3월 리액트버전
1
201
2
npm 설치 오류
1
174
1
chapter_07 콘솔로그 질문드려요~!
1
127
2
안녕하세요 미니블로그 실습 질문드립니다.
1
178
3
에러가 떠요
1
218
3
Chapter6 질문 드립니다
1
208
2
실습 코드 있을까요?
1
205
2
상태가 업데이트될때 컴포넌트 최상단의 console.log 코드가 두번 실행되는 이유가 궁금합니다.
1
233
2
npx create-react-app my-app 명령어 입력이 잘못된 것 같습니다
0
307
3
이름과 코멘트 줄바꿈이 안 됩니다.
0
139
1
버튼이 안 뜹니다
0
303
2
npx create-react-app my-app
1
470
2
jsx 코드 작성해보기에서 index.js 수정 후 에러 뜹니다.
1
375
3
Chapter_05 터미널, 리액트 에러
0
193
2
npx create-react-app my-app 명령어 반응없음
1
432
3
import 코드 에러
1
214
1
백틱
1
121
1

