- onBlur가 왜 안먹히나 보았더니 react-hook-form 에서 register를 등록할때 이미 onBlur가 props로 내려가고 있었다. 그레서 {…rest}의 위치를 맨 앞으로 옮겨주고 내가 만든 onBlur를 뒤로 빼주었더니 우선순위가 내가 만든 onBlur로 가게 되어서 작동하였다.
<Wrapper>
<Label focused={focused}>{label}</Label>
<Input {...rest} onFocus={onFocus} onBlur={onBlur} ref={ref} />
</Wrapper>
'React.JS' 카테고리의 다른 글
공통컴포넌트 any 대신 제네릭을 사용해볼까? (0) | 2023.04.02 |
---|---|
Prop `className` did not match (0) | 2022.01.18 |
React.js와 Codeigniter 연결하기 (0) | 2021.04.26 |
hooks로 componentWillUnmount 구현하기 (0) | 2021.04.14 |
react직접 만들어 보기(2) _ render 메서드 구현 (0) | 2021.01.02 |