Skip to content

Conversation

@timothypark33
Copy link

@timothypark33 timothypark33 commented Dec 21, 2021

리뷰

  • Redux를 전에 여러번 시도했지만 이번 기회에 제대로 이해가 되었습니다. 감사합니다.

  • 최근에 Recoil이 나왔는데 Redux를 배우는 동기부여가 조금 떨어졌었습니다.
    아직은 리덕스가 더 많이 쓰이고 있어서 끝까지 참고 공부해보았습니다.

  • 과제를 진행하다보니 내부 기능들을 까먹게 되는 것같습니다.
    복습의 필요성이 더 커지는 과제였습니다.

  • mockImplementation처럼 jest문법들을 계속 접하게되어 jest를 계속 공부하는 좋은 계기였습니다.

  • 감사합니다!

목표

  • reducer.js 구현
  • action.js 구현
  • InputContainer.jsx 및 테스트 구현
  • ListContainer.jsx 및 테스트 구현
  • 테스트 커버리지 100%

deleteTask,
addTask,
updateTaskTitle
함수 만들어서 App컴포넌트와 분리시키기
useSelector으로 원하는 데이터 사용
dispatch로 action 전달사용
관심사 분리로 빼놓은 함수들을 action로 사용
액션에 맞춰서 데이터 수정
jest.mock('react-redux')로
react-router 모듈을 mock으로 만들었다.
그래서 하위 함수들을 모두 mock으로 만들었다.

13번줄
userSelector.mockImplemention()
로 selector함수 받아서 tasks 데이터 받고 가짜 useSelector을 실행시킨다.
Copy link
Collaborator

@moonkii moonkii left a comment

Choose a reason for hiding this comment

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

image

점진적으로 개선해 나가는 구조가 보이는 것 같아서 좋은 것 같아요 ;)
말씀하신대로 아직까지는 Redux의 점유율이 높기도하고 다양하게 써보시면 좋기 때문에 열심히 해보시면 도움이 많이 되실거에요 ;)

src/App.jsx Outdated
Comment on lines 5 to 9
const initialState = {
newId: 100,
taskTitle: '',
tasks: [],
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 부분은 왜 필요한가요?

Copy link
Author

Choose a reason for hiding this comment

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

refactoring 하면서 삭제했습니다~😀

src/App.jsx Outdated
Comment on lines 11 to 32
function updateTaskTitle(taskTitle) {
return {
type: 'updateTaskTitle',
payload: {
taskTitle,
},
};
}

function addTask() {
return {
type: 'addTask',

};
}

function deleteTask(id) {
return {
type: 'deleteTask',
payload: {
id,
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

이제 따로 분리해주면 좋을 것 같네요 👍

Copy link
Author

Choose a reason for hiding this comment

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

action으로 분리 했습니다!

src/store.js Outdated
tasks: [],
};

function reducer(state = initialState, action) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

reducer 도 이제 분리해주면 좋을 것 같아요 👍

Copy link
Author

Choose a reason for hiding this comment

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

reducer로 분리 했습니다!

@timothypark33
Copy link
Author

리뷰

이번 Redux강의를 한번 제대로 실습 해보니
이번 이번 4-1과제를 잘 마무리 해볼 수 있었습니다.
감사합니다.

Redux

Redux를 구현하고자 reducer와 store, actions로 분류하는 과정이 Redux를 이해하는데 큰 도움이 되었습니다.

관심사 분리

Container의 필요성이 공감되었습니다.
데이터를 관리하는 부분을 따로 만들어 주는것이 나중에 데이터 관련 오류를 접하거나 수정이 필요할 때 빠르게 찾을 수 있어
관리/유지에 유용성을 느꼈습니다.

테스트 코드

테스트 코드 작성이 구현하는 것만큼 시간이 걸렸습니다.
왜 사람들이 테스트 코드를 작성하기 귀찮아 하는지 공감이 되었습니다.(아직 미숙한 것같습니다.)
그러나 지금 실력쌓는 과정속에서 TDD를 접하게되어 초기부터 좋은 코딩습관을 받아들인 것같아 것같아 기쁩니다.

감사합니다!!

Copy link
Collaborator

@moonkii moonkii left a comment

Choose a reason for hiding this comment

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

리덕스도 잘 적용하셨고 테스트 코드도 깔끔하게 잘 작성하신 것 같아요!
주간회고 작성후 공유해주시면 merge 하도록하겠습니다

@moonkii moonkii merged commit 4305edd into CodeSoom:GUAJEGUICHAN Dec 28, 2021
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.

2 participants