Skip to content

Commit b938f5b

Browse files
committed
fix: 워딩 수정, 사용 예시 쿼리키 분리, 불가능한 형태 예제 추가
1 parent b8a595b commit b938f5b

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ function App() {
12571257
12581258
[목차 이동](#주요-컨셉-및-가이드-목차)
12591259
1260-
- 앱 전체에서 사용하는 동일한 쿼리에서 `queryKey`를 사용해 가져와야 할 데이터를 식별하고 싶다면 `QueryClient``queryFn` 옵션을 통해 Default Query Function을 지정해 줄 수 있다.
1260+
- 앱 전체에서 동일한 쿼리 함수를 공유하고, `queryKey`를 사용해 가져와야 할 데이터를 식별하고 싶다면 `QueryClient``queryFn` 옵션을 통해 Default Query Function을 지정해 줄 수 있다.
12611261
- [Default Query Function v4](https://tanstack.com/query/v4/docs/react/guides/default-query-function)
12621262
12631263
```jsx
@@ -1286,14 +1286,16 @@ function App() {
12861286
- `QueryClient`에 앱 전체에서 사용할 쿼리 함수를 지정해 준다.
12871287
12881288
```jsx
1289-
// 사용 예시 (1)
1290-
const useSuperHeroData = () => {
1291-
return useQuery(["superheroes"]); // 2번째 인자에 queryFn을 넣지 않는다.
1289+
// 사용 예시
1290+
const useSuperHeroData = (heroId: string) => {
1291+
return useQuery(["superheroes", heroId]);
12921292
};
1293+
```
12931294
1294-
// 사용 예시 (2)
1295-
const useSuperHeroDetailData = (heroId: string) => {
1296-
return useQuery([`superheroes/${heroId}`]);
1295+
```jsx
1296+
// 다음 형태 불가능
1297+
const useSuperHeroData = (heroId: string) => {
1298+
return useQuery(["superheroes", heroId], () => getSuperHero(heroId));
12971299
};
12981300
```
12991301

0 commit comments

Comments
 (0)