본문 바로가기
[항해99] TIL

61일차 (리액트에서 자주 쓰이는 이벤트의 타입)

by @kkkk_biiin 2023. 11. 8.
728x90

Button

// onClick
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {};

// onMouseDown
const handleMouseDown = (event: React.MouseEvent<HTMLButtonElement>) => {};

// onMouseUp(눌렀다 뗐을 때)
const handleMouseUp = (event: React.MouseEvent<HTMLButtonElement>) => {};

// onMouseEnter (마우스가 요소 위로 올라갔을 때)
const handleMouseEnter = (event: React.MouseEvent<HTMLButtonElement>) => {};

// onMouseLeave (마우스가 요소를 벗어났을 때)
const handleMouseLeave = (event: React.MouseEvent<HTMLButtonElement>) => {};

 

 

input

// onChange (텍스트 변경 시)
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {};

//onFocus (포커스 획득 시)
const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {};

 

 

Form

const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {};

const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {};

const handleSelect = (event: React.SyntheticEvent<HTMLSelectElement>) => {};

const handleInput = (event: React.FormEvent<HTMLInputElement>) => {};

 

Mouse

const handleMouseEnter = (event: React.MouseEvent<HTMLDivElement>) => {};

const handleMouseLeave = (event: React.MouseEvent<HTMLButtonElement>) => {};

const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {};

const handleDoubleClick = (event: React.MouseEvent<HTMLDivElement>) => {};

 

 

KeyBoard

const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {};

const handleKeyUp = (event: React.KeyboardEvent<HTMLInputElement>) => {};

const handleKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {};
728x90

'[항해99] TIL' 카테고리의 다른 글

프로젝트 회고  (1) 2023.11.13
62일차 (Array List와 Linked List)  (1) 2023.11.10
60일차 (Recoil 사용방법 기초 2)  (0) 2023.11.04
59일차 (Recoil 사용방법 기초)  (1) 2023.11.03
57일차 (CS 39, 40, 41)  (0) 2023.11.01