Skip to content

Conversation

@hyunwoo045
Copy link

Issue #1 에 대한 기능 구현입니다.

체크리스트

작성자, 리뷰어 모두가 확인해야할 사항들 입니다.

  • 코드를 실행했을 때 잘 동작하는 코드인지 확인
  • 작성한 코드에 대해 모두 이해하였는지 확인
  • 관련된 label 추가했는지 확인

관련 이슈

설명

Copy link
Contributor

@yuda1124 yuda1124 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 방식은 직접 돔을 수정하는 방식으로 구현되어 있지만 추후 서버와 통신 API를 생각했을 때, 현재 상태를 가지고 이를 토대로 조건부 렌더링을 수행하는 것이 좋을 것 같아요!

function Card(props) {
const dragStart = (e) => {
const target = e.target;
e.dataTransfer.setData("card_id", target.id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이벤트에 데이터를 전달하는 것보다 state로 현재 드래그 중인 카드를 관리하는 게 더 좋을 것 같습니다.

const target = e.target;
e.dataTransfer.setData("card_id", target.id);
setTimeout(() => {
target.style.display = "none";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

직접 돔을 수정하는 것보다 조건부 렌더링이 좋을 것 같아요.

};

const dragOver = (e) => {
e.stopPropagation();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이벤트 전파를 막는 이유는 무엇인가요?

</Card>
</Board>

<Board id="board-2" className="board">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React의 defaultProps와 같은 부분을 사용해서 하드코딩한 부분을 목데이터를 통해서 생성하는 게 좋을 것 같습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drag and Drop Tutorial

3 participants