diff --git a/examples/basic/src/index.js b/examples/basic/src/index.js index ad0d08ee01..cac385f825 100644 --- a/examples/basic/src/index.js +++ b/examples/basic/src/index.js @@ -28,15 +28,6 @@ function App() { ); } -// This function is not inline to show how query keys are passed to the query function -// Normally, you can inline them if you want. -const getPostById = async (key, id) => { - const { data } = await axios.get( - `https://jsonplaceholder.typicode.com/posts/${id}` - ); - return data; -}; - function Posts({ setPostId }) { const { status, data, error, isFetching } = useQuery("posts", async () => { const { data } = await axios.get( @@ -56,7 +47,7 @@ function Posts({ setPostId }) { ) : ( <>
- {data.map(post => ( + {data.map((post) => (

setPostId(post.id)} @@ -67,7 +58,7 @@ function Posts({ setPostId }) { queryCache.getQueryData(["post", post.id]) ? { fontWeight: "bold", - color: "green" + color: "green", } : {} } @@ -85,12 +76,21 @@ function Posts({ setPostId }) { ); } +// This function is not inline to show how query keys are passed to the query function +// Normally, you can inline them if you want. +const getPostById = async (key, id) => { + const { data } = await axios.get( + `https://jsonplaceholder.typicode.com/posts/${id}` + ); + return data; +}; + function Post({ postId, setPostId }) { const { status, data, error, isFetching } = useQuery( ["post", postId], getPostById, { - enabled: postId + enabled: postId, } ); diff --git a/examples/playground/package.json b/examples/playground/package.json index 20304c58e9..77a73d64c0 100644 --- a/examples/playground/package.json +++ b/examples/playground/package.json @@ -33,4 +33,4 @@ "last 1 safari version" ] } -} \ No newline at end of file +} diff --git a/examples/playground/yarn.lock b/examples/playground/yarn.lock index c87b1af8b4..4e1ab7945f 100644 --- a/examples/playground/yarn.lock +++ b/examples/playground/yarn.lock @@ -2688,9 +2688,9 @@ code-point-at@^1.0.0: integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= codemirror@^5.18.2: - version "5.52.0" - resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.52.0.tgz#4dbd6aef7f0e63db826b9a23922f0c03ac75c0a7" - integrity sha512-K2UB6zjscrfME03HeRe/IuOmCeqNpw7PLKGHThYpLbZEuKf+ZoujJPhxZN4hHJS1O7QyzEsV7JJZGxuQWVaFCg== + version "5.55.0" + resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.55.0.tgz#23731f641288f202a6858fdc878f3149e0e04363" + integrity sha512-TumikSANlwiGkdF/Blnu/rqovZ0Y3Jh8yy9TqrPbSM0xxSucq3RgnpVDQ+mD9q6JERJEIT2FMuF/fBGfkhIR/g== collection-visit@^1.0.0: version "1.0.0" @@ -8153,11 +8153,16 @@ react-error-overlay@^6.0.3: resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.6.tgz#ac4d9dc4c1b5c536c2c312bf66aa2b09bfa384e2" integrity sha512-Yzpno3enVzSrSCnnljmr4b/2KUQSMZaPuqmS26t9k4nW7uwJk6STWmH9heNjPuvqUTO3jOSPkHoKgO4+Dw7uIw== -react-is@^16.6.0, react-is@^16.8.1, react-is@^16.8.4: +react-is@^16.6.0, react-is@^16.8.4: version "16.13.0" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.0.tgz#0f37c3613c34fe6b37cd7f763a0d6293ab15c527" integrity sha512-GFMtL0vHkiBv9HluwNZTggSn/sCyEt9n02aM0dSAjGGyqyNlAyftYm4phPxdvCigG15JreC5biwxCgTAJZ7yAA== +react-is@^16.8.1: + version "16.13.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" + integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== + react-query-devtools@1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/react-query-devtools/-/react-query-devtools-1.0.2.tgz#30e3abdb13411af9e28b2a3d0abfea0f56714830"