Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✨ 설명
useOnClickBlock
이라는 커스텀 훅을 생성하여 오류를 개선하였습니다.isDragging
: 드래그중인지 여부를 불리언 값의 상태로 관리합니다.handleMouseDown
: 마우스를 누르면 우선isDragging
을false
로 초기화합니다.handleMouseMove
: 이후 마우스를 누른 상태로 움직인다면isDragging
을�true
로 상태를 업데이트합니다.handleClick
: 마우스를 올렸을 때 (손에서 때었을 때) 드래그 중이라면 early return을, 드래그 중이 아니라면 콜백을 실행시킵니다.이 훅을 슬라이더가 적용된 컴포넌트에 적용시킴으로써 해결하였습니다.
사용 예시
😎 해결한 이슈