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 |
Tags
- background-color 속성
- padding 속성
- tag html
- 일반 형제 결합자
- 자식결합자
- width속성
- iframe 태그
- Checked 의사 클래스
- RGB
- html 태그
- 아두이노
- not 의사클래스
- html tag i
- sup태그
- go live
- sub태그
- Live Server
- focus 의사클래스
- reveal in file explorer
- iframe
- br 태그
- 임베디드
- i 태그
- id 선택자
- RGBA
- height속성
- 인접 형제 결합자
- css
- 전체 선택자
- html
Archives
- Today
- Total
so woon!
[React] import 본문
학습일 : 2023. 03. 15
src 폴더 안에 Button.js 파일을 하나 만들고
function Button({text}) {
return <Button>{text}</Button>;
}
export default Button;
를 적어 준 후 App.js로 간다
맨 위에
import Button from "./Button";
를 적어준다.
이렇게 위와 같이 import 해주면 Button 을 아래에서 사용할 수 있는 상태가 된다.
import Button from "./Button";
function App() {
return (
<div>
<h1>Welcome back!!!!</h1>
<Button />
</div>
);
}
export default App;
이렇게 <Button /> 을 적어주면 사용하는 상태가 되어
위에 적어준 import 가 활성화 되어 불이 들어오게 된다.
'ReactJS > 개념정리' 카테고리의 다른 글
[React] propTypes 설치하기 (0) | 2023.03.16 |
---|---|
[React] 관계성 살펴보기 (0) | 2023.03.16 |
[React] create-react-app (0) | 2023.03.15 |
[React] Prop Types (0) | 2023.03.15 |
[React] React.memo() 의 기능 (0) | 2023.03.14 |
Comments