-
Notifications
You must be signed in to change notification settings - Fork 38
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
[염정훈] sprint12 #327
The head ref may contain hidden characters: "Next-\uC5FC\uC815\uD6C8-sprint12"
[염정훈] sprint12 #327
Conversation
const [isLoggedIn, setIsLoggedIn] = useState<boolean>(false); | ||
const [isLogout, setIsLogout] = useState<boolean>(false); |
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.
isLoggedIn
과 isLoggedOut
은 서로 상반되는 상태라 하나의 상태로 관리해도 될 것 같습니다.
따로 상태를 선언하신 이유가 있을까요? isLoggedIn
이 false이면 로그아웃인걸로 해도 될 것 같아요.
@@ -6,6 +6,9 @@ import "@/styles/global.css"; | |||
|
|||
import type { AppProps } from "next/app"; | |||
import Head from "next/head"; | |||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | |||
|
|||
const queryClient = new QueryClient(); |
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.
query client를 useState의 state에 선언해두면 유저 마다 캐싱을 확실히 할 수 있다고 합니다.
아래의 내용을 읽어보시길 바랍니다 !
console.log(sortOrder, searchKeyword); | ||
|
||
// 전체 게시글 | ||
const {data: articlesData, isLoading: isAllLoading, isError: isAllError} = useQuery({ |
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.
data
, isLoading
, isError` 상태를 각각 다 다루고 계시네요. 잘하셨어요 ~
const handleSignUp = async (e: FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
|
||
try { | ||
const isSignUp = await postSignUp({ | ||
email: signUpEmail, | ||
nickname: signUpNickname, | ||
password: signUpPassword, | ||
passwordConfirmation: signUpPasswordCheck, | ||
}) | ||
if(isSignUp) { | ||
router.push('/login'); | ||
} | ||
} catch (error) { | ||
console.error('회원가입 에러', error) | ||
} | ||
} |
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.
이런 부분도 react-query를 활용해서 mutation hook을 이용하면 서비스 전반적으로 react-query를 써서 일관성이 있을 것 같고, 코드도 패턴이 일관성이 있을 것 같아요.
요구사항
기본
중고마켓
상품 상세
상품 등록
주요 변경사항
스크린샷
멘토에게