Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Solid provides a way to load data from your data sources using the [`createResou
It takes an async function and returns a [signal](/reference/basic-reactivity/create-signal) from it.
`createResource` integrates with [`Suspense`](/reference/components/suspense) and [`ErrorBoundary`](/reference/components/error-boundary) to help manage lifecycle and error states.

```tsx tab title="TypeScript" {6-9}
```tsx tab title="TypeScript" {7-10}
// src/routes/users.tsx
import { For, createResource } from "solid-js";

Expand All @@ -28,7 +28,7 @@ export default function Page() {
}
```

```tsx tab title="JavaScript" {4-7}
```tsx tab title="JavaScript" {5-8}
// src/routes/users.jsx
import { For, createResource } from "solid-js";

Expand All @@ -48,7 +48,7 @@ For the example below we will be using the data in APIs in [`solid-router`](/sol

Using some of the features of `solid-router`, we can create a cache for our data:

```tsx tab title="TypeScript" {6, 9, 12}
```tsx tab title="TypeScript" {7, 10, 13}
// /routes/users.tsx
import { For } from "solid-js";
import { createAsync, query } from "@solidjs/router";
Expand All @@ -71,7 +71,7 @@ export default function Page() {
}
```

```tsx tab title="JavaScript" {4, 7, 10}
```tsx tab title="JavaScript" {5, 8, 11}
// /routes/users.jsx
import { For } from "solid-js";
import { createAsync, query } from "@solidjs/router";
Expand Down Expand Up @@ -112,7 +112,7 @@ Through the `"use server"` comment you can tell the bundler to create an RPC and
This lets you write code that only runs on the server without needing to create an API route for it.
For example, it could be database access or internal APIs, or when you sit within your function and need to use your server.

```tsx tab title="TypeScript" {7}
```tsx tab title="TypeScript" {8}
// /routes/users.tsx
import { For } from "solid-js";
import { createAsync, query } from "@solidjs/router";
Expand All @@ -135,7 +135,7 @@ export default function Page() {
}
```

```tsx tab title="JavaScript" {5}
```tsx tab title="JavaScript" {6}
// /routes/users.jsx
import { For } from "solid-js";
import { createAsync, query } from "@solidjs/router";
Expand Down