seminar-2020 icon indicating copy to clipboard operation
seminar-2020 copied to clipboard

fronted 과제 3번과 관련해서 질문드립니다.(배열 수정)

Open GoGiants1 opened this issue 3 years ago • 2 comments

안녕하세요.

과제 3을 하면서 context를 만들때 Reducer와 dispatch(제 코드에서는 makeAction)를 이용해서 만들고, 다른 기능들은 정상적으로 구현했고 잘 작동하는 상태입니다.

캡처

그러나 edit 페이지에서 원래 값들을 input창에 받아오는 것과 변경된 값들을 받아오는 것도 정상적으로 작동하는데, 수정 버튼을 클릭하면 값이 변경이 되지 않습니다 ㅠㅠ..

캡처1

같은 함수에 호출한 history.push는 실행 되는 것을 확인했는데, makeAction부분이 왜 작동안하는지 도저히 모르겠습니다 ㅠㅠ 도와주세요...

GoGiants1 avatar Oct 13 '20 18:10 GoGiants1

reducer에서 REWRITE 보시면 player.id === action.id로 비교하시구 있습니다. action 객체는 아래와 같은 구조를 가지니 player.id === action.player.id 로 하시면 됩니다

action: {
  type,
  plyaer: {
    id,
    playername,
    team,
    position,
    like
  }
}

ars-ki-00 avatar Oct 14 '20 14:10 ars-ki-00

말씀해주신대로 바꿔보니 잘 동작하네요 !!! 감사합니다 ㅎㅎ

GoGiants1 avatar Oct 14 '20 18:10 GoGiants1