diff --git a/examples/01_typescript/src/App.tsx b/examples/01_typescript/src/App.tsx
index 5472f5f..bcfc7a4 100644
--- a/examples/01_typescript/src/App.tsx
+++ b/examples/01_typescript/src/App.tsx
@@ -1,4 +1,4 @@
-import React, { Suspense } from 'react'
+import React from 'react'
import { useAtom } from 'jotai/react'
import { atom } from 'jotai/vanilla'
import { atomWithQuery } from 'jotai-tanstack-query'
@@ -14,7 +14,11 @@ const userAtom = atomWithQuery((get) => ({
}))
const UserData = () => {
- const [data] = useAtom(userAtom)
+ const [{ data, isPending, isError }] = useAtom(userAtom)
+
+ if (isPending) return
Loading...
+ if (isError) return Error
+
return {JSON.stringify(data)}
}
@@ -36,9 +40,7 @@ const Controls = () => {
const App = () => (
<>
-
-
-
+
>
)
diff --git a/examples/02_refetch/package.json b/examples/02_typescript_suspense/package.json
similarity index 100%
rename from examples/02_refetch/package.json
rename to examples/02_typescript_suspense/package.json
diff --git a/examples/02_refetch/public/index.html b/examples/02_typescript_suspense/public/index.html
similarity index 100%
rename from examples/02_refetch/public/index.html
rename to examples/02_typescript_suspense/public/index.html
diff --git a/examples/02_typescript_suspense/src/App.tsx b/examples/02_typescript_suspense/src/App.tsx
new file mode 100644
index 0000000..0b47e1e
--- /dev/null
+++ b/examples/02_typescript_suspense/src/App.tsx
@@ -0,0 +1,47 @@
+import React from 'react'
+import { useAtom } from 'jotai/react'
+import { atom } from 'jotai/vanilla'
+import { atomWithQuery } from 'jotai-tanstack-query'
+
+const idAtom = atom(1)
+
+const userAtom = atomWithQuery