www.inflearn.com/course/react-%EA%B0%95%EC%A2%8C-velopert/lecture/4144?tab=curriculum
React & Express 를 이용한 웹 어플리케이션 개발하기 - 인프런
Velopert 님이 알려주는 ReactJS 강좌 입니다. 최근 각광받는 Javascript 라이브러리인 React 를 소개하고, 사용법을 알려주는 강좌 입니다. 초급 웹 개발 프레임워크 및 라이브러리 Front-End React 온라인 강
www.inflearn.com
html
1 | <div id="root"></div> | cs |
JS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
class ContactInfo extends React.Component{
render(){
return(
<div>{this.props.contact.name} {this.props.contact.phone}</div>
)
}
}
class Contact extends React.Component{
constructor(props){
super(props); //생성자 초기화
this.state = {
contactData:[
{name:'Abet', phone:'010-0000-0001'},
{name:'Betty', phone:'010-0000-0002'},
{name:'Charite', phone:'010-0000-0003'},
{name:'David', phone:'010-0000-0004'}
]
}
}
render(){
/* 프로그램이 실행되면서 변할 일이 없는 값을 지정할 때 사용하는 상수
* const mapToComponent = (data) => {};
*/
const mapToComponent = (data) => {
return data.map((contact, i) => {
return (<ContactInfo contact = {contact} key = {i} />);
});
};
return (
<div>
{mapToComponent(this.state.contactData)}
</div>
);
}
}
class App extends React.Component {
render() {
return (
<Contact/>
);
}
};
ReactDOM.render(
<App></App>,
document.getElementById("root")
);
|
cs |
'[React]' 카테고리의 다른 글
[React Native] 참고 사이트 (0) | 2021.04.06 |
---|---|
[react-native] react-native run-android 실행 시 오류 (0) | 2021.03.25 |
[react-native]참고 사이트 (0) | 2021.03.25 |
[React.js] state (0) | 2021.02.15 |