Skip to content

Commit 692896d

Browse files
committed
update docs
1 parent ab22daf commit 692896d

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

‎docs/config.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,8 @@
757757
"label": "solid",
758758
"children": [
759759
{
760-
"label": "createQuery",
761-
"to": "framework/solid/reference/createQuery"
760+
"label": "useQuery",
761+
"to": "framework/solid/reference/useQuery"
762762
}
763763
]
764764
},

docs/framework/solid/reference/createQuery.md renamed to docs/framework/solid/reference/useQuery.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
id: createQuery
3-
title: createQuery
2+
id: useQuery
3+
title: useQuery
44
---
55

66
```tsx
@@ -28,7 +28,7 @@ const {
2828
isSuccess,
2929
refetch,
3030
status,
31-
} = createQuery(
31+
} = useQuery(
3232
() => ({
3333
queryKey,
3434
queryFn,
@@ -60,17 +60,17 @@ const {
6060

6161
## Usage example
6262

63-
Here are some examples of how to use the `createQuery` primitive in Solid Query.
63+
Here are some examples of how to use the `useQuery` primitive in Solid Query.
6464

6565
### Basic
6666

67-
The most basic usage of `createQuery` is to create a query that fetches data from an API.
67+
The most basic usage of `useQuery` is to create a query that fetches data from an API.
6868

6969
```tsx
70-
import { createQuery } from '@tanstack/solid-query'
70+
import { useQuery } from '@tanstack/solid-query'
7171

7272
function App() {
73-
const todos = createQuery(() => ({
73+
const todos = useQuery(() => ({
7474
queryKey: 'todos',
7575
queryFn: async () => {
7676
const response = await fetch('/api/todos')
@@ -104,15 +104,15 @@ function App() {
104104

105105
### Reactive Options
106106

107-
The reason why `createQuery` accepts a function that returns an object is to allow for reactive options. This is useful when query options depend on other values/signals that might change over time. Solid Query can track the passed function in a reactive scope and re-run it whenever the dependencies change.
107+
The reason why `useQuery` accepts a function that returns an object is to allow for reactive options. This is useful when query options depend on other values/signals that might change over time. Solid Query can track the passed function in a reactive scope and re-run it whenever the dependencies change.
108108

109109
```tsx
110-
import { createQuery } from '@tanstack/solid-query'
110+
import { useQuery } from '@tanstack/solid-query'
111111

112112
function App() {
113113
const [filter, setFilter] = createSignal('all')
114114

115-
const todos = createQuery(() => ({
115+
const todos = useQuery(() => ({
116116
queryKey: ['todos', filter()],
117117
queryFn: async () => {
118118
const response = await fetch(`/api/todos?filter=${filter()}`)
@@ -151,13 +151,13 @@ function App() {
151151

152152
### Usage with `Suspense`
153153

154-
`createQuery` supports triggering SolidJS `Suspense` and `ErrorBoundary` components when the query is in a pending or error state. This allows you to easily handle loading and error states in your components.
154+
`useQuery` supports triggering SolidJS `Suspense` and `ErrorBoundary` components when the query is in a pending or error state. This allows you to easily handle loading and error states in your components.
155155

156156
```tsx
157-
import { createQuery } from '@tanstack/solid-query'
157+
import { useQuery } from '@tanstack/solid-query'
158158

159159
function App() {
160-
const todos = createQuery(() => ({
160+
const todos = useQuery(() => ({
161161
queryKey: 'todos',
162162
queryFn: async () => {
163163
const response = await fetch('/api/todos')
@@ -184,7 +184,7 @@ function App() {
184184
}
185185
```
186186

187-
## `createQuery` Parameters
187+
## `useQuery` Parameters
188188

189189
- ### Query Options - `Accessor<QueryOptions>`
190190

@@ -298,9 +298,9 @@ function App() {
298298
- Optional
299299
- Use this to use a custom QueryClient. Otherwise, the one from the nearest context will be used.
300300

301-
## `createQuery` Return Value - `Store<QueryResult<TData, TError>>`
301+
## `useQuery` Return Value - `Store<QueryResult<TData, TError>>`
302302

303-
`createQuery` returns a SolidJS store with the following properties:
303+
`useQuery` returns a SolidJS store with the following properties:
304304

305305
- ##### `status: QueryStatus`
306306
- Will be:

0 commit comments

Comments
 (0)