@@ -14,6 +14,7 @@ Support for Vue 2.x via [vue-demi](https://github.com/vueuse/vue-demi)
1414Based on [ react-query] ( https://github.com/tannerlinsley/react-query )
1515
1616# Documentation
17+
1718Visit [ damianosipiuk.github.io/vue-query] ( https://damianosipiuk.github.io/vue-query/ )
1819
1920# Quick Features
@@ -32,26 +33,36 @@ Visit [damianosipiuk.github.io/vue-query](https://damianosipiuk.github.io/vue-qu
3233
3334# Quick Start
3435
35- 1 . Attach vue-query to your Vue application
36+ 1 . Attach ** Vue Query ** to the root component of your Vue application
3637
3738 ``` ts
38- import { createApp } from " vue" ;
39- import { QueryClient , VUE_QUERY_CLIENT } from " vue-query" ;
40-
41- import App from " ./App.vue " ;
42-
43- const queryClient = new QueryClient ();
44- queryClient . mount ();
45-
46- createApp ( App ). provide ( VUE_QUERY_CLIENT , queryClient ). mount ( " #app " );
39+ import { defineComponent } from " vue" ;
40+ import { useQueryProvider } from " vue-query" ;
41+
42+ export default defineComponent ({
43+ name: " App " ,
44+ setup() {
45+ useQueryProvider ();
46+ },
47+ } );
4748 ```
4849
49502 . Use query
5051
5152 ``` ts
53+ import { defineComponent } from " vue" ;
5254 import { useQuery } from " vue-query" ;
5355
54- const query = useQuery (" todos" , getTodos );
56+ export default defineComponent ({
57+ name: " MyComponent" ,
58+ setup() {
59+ const query = useQuery (" todos" , getTodos );
60+
61+ return {
62+ query ,
63+ };
64+ },
65+ });
5566 ```
5667
57683 . If you need to update options on your query dynamically, make sure to pass it as reactive property
@@ -61,8 +72,7 @@ Visit [damianosipiuk.github.io/vue-query](https://damianosipiuk.github.io/vue-qu
6172 const queryKey = reactive ([" todos" , { id }]);
6273 const queryFunction = () => getTodos (id );
6374 const options = reactive ({
64- staleTime: 60 * 60 ,
65- onSuccess : () => {},
75+ enabled: false ,
6676 });
6777
6878 const query = useQuery (queryKey , queryFunction , options );
0 commit comments