Suspense with Solid
Farfetched has a Solid integration with Suspense support, just install @farfetched/solid
.
sh
pnpm install @farfetched/solid
sh
yarn add @farfetched/solid
sh
npm install @farfetched/solid
And use createQueryResource
to create a resource for your Query:
tsx
import { createQueryResource } from '@farfetched/solid';
function UserProfile() {
const [user] = createQueryResource(userQuery);
return (
<Suspense fallback={<Loading />}>
<section>
<p>{user().name}</p>
<p>{user().email}</p>
</section>
</Suspense>
);
}