From 8190d27dd26798063e4da54ea8733de2f0e18bcf Mon Sep 17 00:00:00 2001 From: Nikita Gaziev <98274273+zobweyt@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:10:40 +0300 Subject: [PATCH] docs: format code in examples in `guides/fetching-data.mdx` (#928) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- src/routes/guides/fetching-data.mdx | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) 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}
  • )}
- + ); }