250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- css3
- 백엔드
- 애니메이션
- ipad
- 비전공자
- php
- button
- Animation
- react
- 프론트엔드
- jQuery
- CSS
- iOS 개발자
- html5
- IOS
- HTML
- xcode
- SWIFT
- iPhone
- 개발자
- MAC
- 비전공 개발자
- front-end
- effect
- javascript
- keyframes
- 자바스크립트
- hover
- 풀스택
- image
Archives
- Today
- Total
비전공자 개발일기
React - Basic 본문
728x90
SMALL
<div id="root"></div>
class Codelab extends React.Component {
render() {
let text = "I'm IRONMAN"
let style = {
backgroundColor: "aqua"
}
return(
<div style={style}>{text}</div>
);
}
}
class App extends React.Component {
render() {
return(
<Codelab/>
)
}
}
ReactDOM.render(<App/>,document.querySelector("#root"))
-------------------------------------------------------------------
class Codelab extends React.Component {
render() {
return(
<div>
<div>Hello {this.props.name}</div>
<div>{this.props.children}</div>
</div>
);
}
}
class App extends React.Component {
render() {
return(
<Codelab name="IRONMAN">여기 값</Codelab>
);
}
}
ReactDOM.render(<App/>,document.querySelector("#root"))
-------------------------------------------------------------------
class Codelab extends React.Component {
render() {
return(
<div>
<div>Hello {this.props.name}</div>
<div>{this.props.children}</div>
</div>
);
}
}
class App extends React.Component {
render() {
return(
<Codelab name={this.props.name}>{this.props.children}</Codelab>
);
}
}
ReactDOM.render(<App name="IRONMAN"> Here it is!</App>,document.querySelector("#root"))
-------------------------------------------------------------------
import * as propTypes from "https://cdn.skypack.dev/prop-types@15.7.2";
class Codelab extends React.Component{
render() {
return(
<div>
<h1>Hello {this.props.name}</h1>
<h2>{this.props.number}</h2>
<div>{this.props.children}</div>
</div>
);
}
}
Codelab.propTypes = {
name: PropTypes.string,
number: PropTypes.number.isRequired
};
Codelab.defaultProps = {
name: "unknown"
}
class App extends React.Component {
render() {
return(
<Codelab name={this.props.name} number={this.props.number}>{this.props.children}</Codelab>
);
}
}
ReactDOM.render(<App number={5}> Here it is!</App>,document.querySelector("#root"))
728x90
LIST
'React & React Native' 카테고리의 다른 글
React Native - Hello World 출력 및 환경 설정 (0) | 2022.01.09 |
---|---|
React vs React Native (0) | 2021.12.28 |
mini blog with React (0) | 2021.12.26 |
React (0) | 2021.12.19 |
React (0) | 2021.08.15 |