diff --git a/pages/myPage/userInfo.tsx b/pages/myPage/userInfo.tsx index 0ca07fd..7019b02 100644 --- a/pages/myPage/userInfo.tsx +++ b/pages/myPage/userInfo.tsx @@ -1,5 +1,9 @@ import { UserInfo } from "@views/myPage"; import styled from "@emotion/styled"; +import { GetServerSideProps } from "next"; +import { dehydrate, QueryClient } from "react-query"; +import queryKey from "@constants/queryKey"; +import { getMyInfo } from "@apis/myPage"; const UserInfoContainer = () => ( @@ -7,6 +11,18 @@ const UserInfoContainer = () => ( ); +export const getServerSideProps: GetServerSideProps = async () => { + const queryClient = new QueryClient(); + + await queryClient.prefetchQuery([queryKey.myInfo], getMyInfo); + + return { + props: { + dehydratedState: dehydrate(queryClient), + }, + }; +}; + export default UserInfoContainer; const Container = styled.section`