Skip to content

[이유진] 9주차 과제 제출 #48

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

Open
wants to merge 2 commits into
base: member/yujin
Choose a base branch
from

Conversation

pororori
Copy link

결과 소개

(화면 스크린샷 또는 녹화 첨부)

기능 설명

(커밋이나 큰 기능 단위 별 설명)

어려웠던 점, 질문

(없다면 생략 가능)

Copy link

@his0si his0si left a comment

Choose a reason for hiding this comment

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

흠잡을 곳 없는 완성도 있는 과제였습니다. 참고할만한 사항 몇개만 코드리뷰 올려드렸습니다. 과제하느라 수고많으셨어요!

Copy link

Choose a reason for hiding this comment

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

라우팅 배우신대로 잘 하셨습니다! 다만 라우터가 중첩 구조가 아니어서 상위 레이아웃(헤더·네비) 재사용이 어려울 수 있기 때문에 아래와 같은 방법도 공유드려요

// routes.jsx const router = createBrowserRouter([ { path: "/", element: <Layout />, // 공통 헤더 children: [ { index: true, element: <SignUpForm /> }, { path: "boards", element: <BoardsLayout />, // Outlet children: [ { index: true, element: <BoardListPage /> }, { path: "write", element: <BoardWritePage /> }, { path: ":boardId", element: <BoardDetailPage /> }, { path: ":boardId/edit", element: <BoardEditPage /> }, { path: ":boardId/posts", element: <PostListPage /> }, { path: ":boardId/write", element: <PostWritePage /> }, ], }, { path: "posts/:postId", element: <PostDetailPage /> }, { path: "edit/:postId", element: <PostEditPage /> }, ], }, ]);

@@ -0,0 +1,194 @@
import React, { useState } from "react";
Copy link

Choose a reason for hiding this comment

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

-import React, { useState } from "react";
+import React, { useState, useEffect } from "react";

Copy link

Choose a reason for hiding this comment

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

POST 전체를 가져와 중복 Board를 reduce로 잘 제거하셨습니다. 다만 조금 비효율적일 수 있으니 백엔드에 GET /boards(pageable) 엔드포인트를 먼저 요청 → 없으면 /posts?size=1&fields=board 같은 가벼운 쿼리도 사용해보길 권장합니다.
const { data: boards = [], isLoading, error } = useQuery(["boards"], () => axiosInstance.get("/boards").then(r => r.data));

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