File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 505026 . [ 사용자 경험(UX)을 올려주는 Optimistic Updates(낙관적 업데이트)] ( #optimistic-update )
515127 . [ 에러가 발생했을 때 Fallback UI를 선언적으로 보여주기 위한 ErrorBoundary + useQueryErrorResetBoundary] ( #usequeryerrorresetboundary )
525228 . [ 서버 로딩중일 때 Fallback UI를 선언적으로 보여주기 위한 Suspense] ( #suspense )
53- 29 . [ 앱의 기본 쿼리를 설정하는 Default Query Function] ( #default-query-function )
53+ 29 . [ 앱 전체에 동일한 쿼리 함수를 공유하는 Default Query Function] ( #default-query-function )
545430 . [ 리액트 쿼리에 타입스크립트 적용] ( #react-query-typescript )
5555
5656<br />
@@ -1263,16 +1263,24 @@ function App() {
12631263` ` ` jsx
12641264// 기본 쿼리 함수
12651265const getSuperHero = async ({ queryKey }: any ) => {
1266- return await axios .get (` http://localhost:4000/${ queryKey[0 ]} ` );
1266+ const heroId = queryKey[1 ];
1267+ return await axios .get (` http://localhost:4000/superheroes/${ heroId} ` );
12671268};
12681269
12691270const queryClient = new QueryClient ({
12701271 defaultOptions: {
12711272 queries: {
12721273 queryFn: getSuperHero,
1274+ // ...queries options
12731275 },
12741276 },
12751277});
1278+
1279+ function App () {
1280+ return (
1281+ < QueryClientProvider client= {queryClient}> {/* ... */ }< / QueryClientProvider>
1282+ );
1283+ }
12761284` ` `
12771285
12781286- ` QueryClient` 에 앱 전체에서 사용할 쿼리 함수를 지정해 준다.
You can’t perform that action at this time.
0 commit comments