4주차 개인 프로젝트 '나만의 캘린더' 만들기
"Scheduler"
📌필수 구현 기능
✅ 게시글 목록 페이지
✅ 게시글 작성 페이지
파이어베이스를 제외한 crud 기능 구현

이 부분은 큰 막힘 없이 구현 가능 했던 것 같다.
//action
const LOAD_SCH = "LOAD_SCH";
const ADD_SCH = "ADD_SCH";
const EDIT_SCH = "EDIT_SCH";
const DEL_SCH = "DEL_SCH";
const ON_POPUP = "ON_POPUP";
const SHOW_SCH = "SHOW_SCH";
//action creator
const loadSch = createAction(LOAD_SCH, (sch_list) => ({ sch_list }));
const addSch = createAction(ADD_SCH, (sch) => ({ sch }));
const editSch = createAction(EDIT_SCH, (sch_id) => ({ sch_id }));
const delSch = createAction(DEL_SCH, (sch_id) => ({ sch_id }));
const onPopup = createAction(ON_POPUP, (is_popup) => ({ is_popup }));
const showSch = createAction(SHOW_SCH, (show_end) => ({ show_end }));
//reducer
export default handleActions(
{
[LOAD_SCH]: (state, action) =>
produce(state, (draft) => {
draft.sch_list = action.payload.sch_list;
}),
[ADD_SCH]: (state, action) =>
produce(state, (draft) => {
draft.sch_list.unshift(action.payload.sch);
}),
[EDIT_SCH]: (state, action) =>
produce(state, (draft) => {
let idx = draft.sch_list.findIndex(
(s) => s.id === action.payload.sch_id
);
draft.sch_list[idx] = {
...draft.sch_list[idx],
is_end: true,
color: "green",
};
}),
[DEL_SCH]: (state, action) =>
produce(state, (draft) => {
let idx = draft.sch_list.findIndex(
(s) => s.id === action.payload.sch_id
);
draft.sch_list.splice(idx, 1);
}),
[ON_POPUP]: (state, action) =>
produce(state, (draft) => {
draft.is_popup = action.payload.is_popup;
}),
[SHOW_SCH]: (state, action) =>
produce(state, (draft) => {
draft.show_end = action.payload.show_end;
if (draft.show_end) {
draft.sch_list.map((s, idx) => {
if (!s.is_end) {
draft.sch_list[idx] = { ...s, display: "none" };
}
});
} else {
draft.sch_list.map((s, idx) => {
draft.sch_list[idx] = { ...s, display: "auto" };
draft.show_end = false;
});
}
}),
},
initialState
);
요즘 느끼는 것
아무런 베이스도 없이 항해를 시작 하며 난생 처음 코딩을 하게 되어서 아직 아는게 별로 없는데도 불구하고 감사하게도 나한테 질문을 꾸준히 해주시는 분들이 계신다.
배운 기간이 길지도 않고 아직 경험도 없기에 물어보시는 질문의 99%는 경험해 보지 못한 에러여서 해결 하는데 시간이 조금 오래 걸리지만 오는 질문을 절대 마다하지 않고 내 에러를 처리한다는 생각으로 끝까지 파고들기에 대부분은 결국 해결이 되는 것 같다.
강의를 들으며 얕게 배운 코드를 다른 분들의 질문을 통해 조금 더 자세하게 하나 하나 보게 되고 오히려 질문을 받은 내가 더 배우면서 같이 에러를 찾아 나가기 때문에 가장 많은 성장을 한다고 느끼고 있는 부분이다.
아무래도 이제 팀 프로젝트에 들어가면 이렇게 마음놓고 질문을 주고 받기가 힘들 것 같아 이번주에 최대한 많이 공부하고 해결하며 기본을 다져 놓아야겠다는 생각이 있다.