Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/framework/react/guides/query-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,18 @@ queryClient.setQueryData(groupOptions(42).queryKey, newGroups)
[//]: # 'Example1'

For Infinite Queries, a separate [`infiniteQueryOptions`](../reference/infiniteQueryOptions.md) helper is available.

You can still override some options at the component level. A very common and useful pattern is to create per-component [`select`](../guides/render-optimizations.md#select) functions:

Comment thread
TkDodo marked this conversation as resolved.
[//]: # 'Example2'

```ts
// Type inference still works, so query.data will be the return type of select instead of queryFn

const query = useQuery({
...groupOptions(1),
select: (data) => data.groupName,
})
```

[//]: # 'Example2'