Skip to content
Closed
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
10 changes: 8 additions & 2 deletions src/routes/solid-router/reference/data-apis/create-async.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,14 @@ While the fetcher is executing for the first time, unless an `initialValue` is s
import { createAsync, query } from "@solidjs/router";

const getUserQuery = query(async (id: string) => {
// You can use the parameters here
console.log(id);

// ... Fetches the user from the server.
}, "user");

function UserProfile() {
const user = createAsync(() => getUserQuery());
const user = createAsync(() => getUserQuery("user-123"));

return <p>{user()?.name}</p>;
}
Expand All @@ -123,11 +126,14 @@ import { Suspense, ErrorBoundary, For } from "solid-js";
import { createAsync, query } from "@solidjs/router";

const getUserQuery = query(async (id: string) => {
// You can use the parameters here
console.log(id);

// ... Fetches the user from the server.
}, "user");

function UserProfile() {
const user = createAsync(() => getUserQuery());
const user = createAsync(() => getUserQuery("user-123"));

return (
<ErrorBoundary fallback={<p>Could not fetch user data.</p>}>
Expand Down