Skip to content

Commit

Permalink
docs(solid-query): add optional chaining to prevent suspense bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvy1 authored Jul 10, 2024
1 parent b58da75 commit 2c8265b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/framework/solid/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ SolidJS has been gaining popularity as a fast, reactive, and declarative library

```tsx
import { createResource, ErrorBoundary, Suspense } from 'solid-js'
import { render } from 'solid-js/web'

function App() {
const [repository] = createResource(async () => {
Expand All @@ -26,7 +27,7 @@ function App() {
<ErrorBoundary fallback={<div>Something went wrong!</div>}>
{/* Suspense will trigger a loading state while the data is being fetched */}
<Suspense fallback={<div>Loading...</div>}>
<div>{repository().updated_at}</div>
<div>{repository()?.updated_at}</div>
</Suspense>
</ErrorBoundary>
</div>
Expand Down Expand Up @@ -100,7 +101,7 @@ function App() {
The `data` property on a query is a SolidJS resource
so it will work with Suspense and transitions out of the box!
*/}
<div>{repositoryQuery.data.updated_at}</div>
<div>{repositoryQuery.data?.updated_at}</div>
</Suspense>
</ErrorBoundary>
</div>
Expand Down

0 comments on commit 2c8265b

Please sign in to comment.