-
Notifications
You must be signed in to change notification settings - Fork 3
refactor: #118/DonationsList의 데이터 불러오는 방식 변경 #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| import { StrictMode } from 'react'; | ||
| // import { StrictMode } from 'react'; | ||
| import { createRoot } from 'react-dom/client'; | ||
| import '@/index.css'; | ||
| import App from './App.jsx'; | ||
|
|
||
| createRoot(document.getElementById('root')).render( | ||
| <StrictMode> | ||
| <App /> | ||
| </StrictMode> | ||
| // <StrictMode> | ||
| <App /> | ||
| // </StrictMode> | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cursorArr.pop()으로는 cursorArr의 주소가 바뀌지 않아 setCursorArr(cursorArr)를 했을 때 리렌더링을 유도할 수는 없을 거 같아요!
리렌더링을 유도하지 않았더라도 cursorArr.pop()은 불변성을 훼손하기에 좋지 않은 거 같아요!
https://github.com/reactjs/react-basic?tab=readme-ov-file#state
리액트 컨트리뷰터가 작성한 글인데 state는 불변 데이터인 것이 상태 관리를 더 명확하고 예측 가능하게 한다고 해요!
그리고 위의 history.length > 1 조건처럼 cursor: cursorArr[cursorArr.length - 2] 에도 조건이 필요해 보여요! 그렇지 않으면 cursor=undefined로 전달되어서 멘토링 시간에 봤던 400 에러 발생할 거 같아요! 라고 했는데 잘 동작하네요?
혹시 몰라 길이에 대한 처리도 했는데 바로 slice한 값을 넣어도 될 거 같네요!
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
우와 감사합니다! 효준님께서 알려주신 방법으로 수정해봐야겠네요! 400에러가 발생하지 않고 잘 동작한 건 cursorArr의 배열에 0을 초기값으로 넣어줘서인 것 같습니다! 그리고 cursorArr의 길이가 1 이하이면 이전 버튼을 비활성화 시켜서 배열의 길이가 1 미만이 될 일도 없고요! 꼼꼼하게 봐주시고 피드백까지 정성스럽게 남겨주셔서 감사합니다~!