diff --git a/src/routes/reference/basic-reactivity/create-resource.mdx b/src/routes/reference/basic-reactivity/create-resource.mdx index 7b31b5a623..56c33c807e 100644 --- a/src/routes/reference/basic-reactivity/create-resource.mdx +++ b/src/routes/reference/basic-reactivity/create-resource.mdx @@ -8,11 +8,11 @@ There are two ways to use `createResource`: you can pass the fetcher function as The source signal will retrigger the fetcher whenever it changes, and its value will be passed to the fetcher. ```tsx -const [data, { mutate, refetch, state }] = createResource(fetchData) +const [data, { mutate, refetch }] = createResource(fetchData) ``` ```tsx -const [data, { mutate, refetch, state }] = createResource(source, fetchData) +const [data, { mutate, refetch }] = createResource(source, fetchData) ``` In these snippets, the fetcher is the function `fetchData`, and `data()` is undefined until `fetchData` finishes resolving. @@ -49,7 +49,7 @@ async function fetchData(source, { value, refetching }) { // or equal to the optional data passed: `refetch(info)` } -const [data, { mutate, refetch, state }] = createResource(getQuery, fetchData) +const [data, { mutate, refetch }] = createResource(getQuery, fetchData) // read value data() @@ -102,7 +102,7 @@ You can use the new `ssrLoadFrom` option for this. Instead of using the default `server` value, you can pass `initial` and the resource will use `initialValue` as if it were the result of the first fetch for both SSR and hydration. ```tsx -const [data, { mutate, refetch, state }] = createResource(() => params.id, fetchUser, { +const [data, { mutate, refetch }] = createResource(() => params.id, fetchUser, { initialValue: preloadedData, ssrLoadFrom: "initial", })