24.03.01 01:16 작성
·
409
0
react-query ssr 설정하기인데 어느 부분이 ssr 설정인지 잘모르겠습니다 어느부분인가요??
export async function getPostRecommends({ pageParam }: Props) {
const res = await fetch(
`http://localhost:9090/api/postRecommends?cursor=${pageParam}`,
{
next: {
tags: ["posts", "recommends"],
},
}
);
// The return value is *not* serialized
// You can return Date, Map, Set, etc.
if (!res.ok) {
// This will activate the closest `error.js` Error Boundary
throw new Error("Failed to fetch data");
}
return res.json();
}
답변 1
1
2024. 03. 01. 01:29
아, 이 함수는 단순히 백엔드서버로부터 데이터를 받아오는 거고요.
prefetchQuery랑 HydrationBoundary가 ssr 코드입니다.