Skip to content

Commit 18ba7c0

Browse files
meatnordrinkTkDodo
andauthored
docs(query-keys): clarify query key refetching (#5653)
* docs(query-keys): clarify query key refetching Update the query-key documentation to note that changing data included in a query key will automatically refetch the query data. It took me a long time to find this information, and I expected to find it here. I consulted with another engineer on our team, and they agreed that they would expect to see it stated more clearly here. So we felt this addition would be helpful. * Update docs/react/guides/query-keys.md * Update docs/react/guides/query-keys.md --------- Co-authored-by: Dominik Dorfmeister <[email protected]>
1 parent e91f751 commit 18ba7c0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/react/guides/query-keys.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ function Todos({ todoId }) {
9090
```
9191

9292
[//]: # 'Example5'
93+
94+
Note that query keys act as dependencies for your query functions. Adding dependent variables to your query key will ensure that queries are cached independently, and that any time a variable changes, *queries will be refetched automatically (depending on your `staleTime` settings).* (See the [exhaustive-deps](../eslint/exhaustive-deps) section for more information and examples.)
9395
[//]: # 'Materials'
9496

9597
## Further reading

0 commit comments

Comments
 (0)