- DOM 요소에만 이벤트 설정이 가능하다.
- 직접 만든 리액트 컴포넌트에는 이벤트를 자체적으로 설정할수없다.
- <div> <button> <p> <input>등 DOM요소에만 이벤트 적용 가능하다.
// 이렇게 사용하지 못한다. <EventPractice onLoad={ () => {console.log("test");}} />
< 많이 쓰는 DOM 이벤트 >- onClick
- onChange
- onKeyDown , onKeyUp , onKeyPress (키보드 입력이 일어났을때)
- onDoubleClick (element 더블클릭했을때)
- onFocus (element 에 focus될때)
- onBlur (element 가 focus 잃었을때)
- onSubmit (form element에서 submit 했을때)
'개발' 카테고리의 다른 글
| < html > vs code에서 유용한 html 자동완성 (0) | 2022.06.24 |
|---|---|
| <html> herf, src, url 차이점 (0) | 2022.06.24 |
| < React > Router 정리 (1) | 2022.06.24 |
| < React > custom Hook 만들기 #2 (0) | 2022.06.24 |
| < React > custom Hooks 만들기 #1 (0) | 2022.06.24 |