리액트 이벤트처리
-
리액트 기초이론 7 - 이벤트(Event) 처리하기 해답프론트엔드/React 연습과제 해답 2022. 3. 9. 19:10
* 연습과제 1 import './App.css'; import React, { Component } from 'react'; import youtubeVideos from './youtubeVideos' import Button from './Button' class App extends Component { state = { index: 0 } decreaseIndex = () => { const nextIndex = this.state.index - 1 this.setState({index: (nextIndex { const nextIndex = this.state.index..
-
리액트 기초이론 7 - 이벤트(Event) 처리하기프론트엔드/React 2021. 11. 7. 19:16
이벤트 처리 참고문서 이벤트 처리하기 – React A JavaScript library for building user interfaces ko.reactjs.org * 기본적인 개념 open 일반적인 HTML 문서에서 이벤트핸들러 함수를 등록할때는 위와 같이 작성한다. (인라인 이벤트등록 방식) open 리액트에서는 이벤트 이름에 카멜케이스를 사용한다. 그리고 JSX 문법을 이용하여 문자열이 아닌 함수로 등록한다. * 이벤트핸들러 함수의 this import './App.css'; import React, { Component } from 'react'; class App extends Component { showAlert() { console.log(this) alert('this is alert..