diff --git a/src/routes/guides/fetching-data.mdx b/src/routes/guides/fetching-data.mdx index 7a3f18cee..5a1810d28 100644 --- a/src/routes/guides/fetching-data.mdx +++ b/src/routes/guides/fetching-data.mdx @@ -34,8 +34,7 @@ When there is a change in the source signal, an internal fetch process is trigge ```jsx import { createSignal, createResource, Switch, Match, Show } from "solid-js"; -const fetchUser = async (id) => - { +const fetchUser = async (id) => { const response = await fetch(`https://swapi.dev/api/people/${id}/`); return response.json(); } @@ -63,7 +62,6 @@ function App() {
{JSON.stringify(user())}
- ); } @@ -91,7 +89,7 @@ import { createSignal, createResource, Switch, Match, Suspense } from "solid-js" const fetchUser = async (id) => { const response = await fetch(`https://swapi.dev/api/people/${id}/`); return response.json(); - } +} function App() { const [userId, setUserId] = createSignal(); @@ -106,7 +104,6 @@ function App() { onInput={(e) => setUserId(e.currentTarget.value)} /> Loading...}> - Error: {user.error.message} @@ -152,15 +149,19 @@ function TodoList() { <>
    - {task => ( + {(task) => (
  • {task.name}
  • )}
- + ); }