위와 같이 서버에서도 문제없이 응답받고 있고, DB에서 잘 저장이 됩니다. 다만 리덕스상에서 계속해서 실패 를 합니다. 아래 사가 파일 코드 상에서 실패시 받는 에러도 뭔지 알수가 없습니다. console.error(e)로 접근하려해도 undefined 뜨고요. DB에는 정상적으로 들어갔으니 새로고침해야 제대로 업데이트되는 상황입니다. post.js/sagas post.js/reducers post.js/routes user.js/reducers 위 파일들에서 포스트 추가 관련된 코드 다 동일한데...뭘 더 확인해야할지 어떻게 해야할지 모르겠습니다. 계속 삽질하고 있을 순 없고 우선 진도는 빼야할 것 같아서 이렇게 질문드립니다. function * addPost ( action ) { try { const result = yield call (addPostAPI, action.data); yield put ({ //post 리듀서 데이터 수정 type: ADD_POST_SUCCESS, data: result.data }); yield put ({ //user 리듀서의 데이터 수정 type: ADD_POST_TO_ME, data: result.data.id }); } catch (e) { yield put ({ type: ADD_POST_FAILURE, error: e }); } }
선생님의 강의를 듣기 전에 직접 문제를 풀어보았는데 해설 강의를 듣고나서 고민이 생겨 질문드립니다. 우선 제가 풀이한 방식은 다음과 같습니다. int main(){ //freopen("input.txt", "rt", stdin); int n, i, j, end, sum = 0, cnt=0; scanf("%d", &n); if (n%2 == 0) end = n/2; else end = (n/2)+1; for (i = end; i >= 1; i--) { sum += i; if (sum == n) { printf("%d ", i); for (j = i+1; j <= end; j++) printf("+ %d ", j); printf("= %d\n", n); sum -= end; end--; cnt++; } else if (sum > n) { sum -= end; end--; } } printf("%d", cnt); return 0; } 입력받은 숫자 N부터 1씩 감소시키면서 sum에 누적하고 그 값이 처음의 N값과 동일하면 수식을 출력하는 방식으로 코드를 작성했습니다. 제공해주신 채점기를 돌려본 결과도 100점이 나왔구요. 그런데 강의를 들어보니, 저라면 몇 시간을 주어도 몰랐을 풀이법으로 문제를 해결하시더라구요. 강의 앞에서 말씀하셨다시피 지원자의 직감도 중요하게 보는 것 같은데 혹시 문제를 해결함에 있어서 이런 직감적인 부분을 얻으려면 어떻게 해야하는건가요? 문제를 풀면서 이런 방식을 발견할 때마다 외워야만 가능한 건가요? 아니면 문제를 풀다보면 자연스럽게 배워지는 부분인건가요?
댓글 달때요, 게시글에있는 댓글 버튼을 클릭하면, 댓글창이 생기잖아요. 댓글버튼을 클릭함과 동시에, warning 이 뜨네요 .. react-dom.development.js:11494 Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details. * Move data fetching code or side effects to componentDidUpdate. * If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state * Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder. Please update the following components: Animate 이라는 warning 인데요.. 제가 코드 하나하나 체크하면서 봤는데요. 뜨는곳이, component/PostCard.js const PostCard = ({ post }) => { ... return ( <> .... { commentFormOpened && ( <> < Form onSubmit = { onSubmitComment } > < Form.Item > // <- 이 부분에서 뜨는데요 < Input.TextArea rows = { 4 } value = { commentText } onChange = { onChangeCommentText } /> </ Form.Item > // <- 이 부분에서 뜨는데요 < Button type = "primary" htmlType = "submit" loading = { isAddingComment } > 삐약 </ Button > </ Form > < List header = { ` ${ post . Comments ? post . Comments . length : 0 } 댓글` } dataSource = { post . Comments || [] } renderItem = { item => ( < li > < Comment author = { item . User . nickname } avatar = { < Avatar > { item . User . nickname [ 0 ] } </ Avatar > } content = { item . content } /> </ li > ) } /> */} </> ) } </> ); }; ... < Form.Item > 을 안 쓰면, 저런 warning 이 안뜨는데, 정확한 이유를 모르겠네요... 혹시 아시나요 ? ??