Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document: add guide for using props as a key of query #8088

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
10 changes: 10 additions & 0 deletions docs/framework/vue/guides/query-keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,13 @@ function useTodos(todoId) {
```

[//]: # 'Example5'

### If your query function depends on a props value, include it in your query key using getter syntax

```js
<script setup>
const props = defineProps([todoId]);
const queryKey = ['todos', ()=> props.todoId] ;
const result = useQuery(queryKey, () => fetchTodoById(props.todoId));
</script>
```
Loading