728x90
컴포넌트 생성 및 불러오기
- EventPractice 만들기
import React,{Component} from 'react'; //클래스형 컴포넌트 생성 class EventPractice extends Component { render(){ return( <div> <h1>이벤트 연습</h1> </div> ); }; } export default EventPractice;
App.js에서 EventPractice 렌더링
- App.js에서 EventPraitice를 불러와 렌더링 하기
-
import React from "react"; import EventPractice from "./EventPractice"; const App = () => { return <EventPractice />; }; export default App; 
결과
728x90
'리액트 > 이벤트핸들링' 카테고리의 다른 글
| ch06.함수형 컴포넌트로 구현 (0) | 2021.08.10 |
|---|---|
| ch05.Input 여러 개 다루기,OnKeyPress 이벤트 핸들링 (0) | 2021.08.10 |
| ch04.임의 메소드 만들기 (0) | 2021.08.10 |
| ch03.onChange 이벤트 설정 (0) | 2021.08.02 |
| ch01.리액트의 이벤트 시스템 (0) | 2021.08.02 |