Skip to content

Commit 44fa9aa

Browse files
gaspardtimdorr
andauthored
Small typos and fixes to the tutorial (#11598)
Co-authored-by: Tim Dorr <[email protected]>
1 parent f240263 commit 44fa9aa

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

contributors.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
- frontsideair
8484
- fyzhu
8585
- fz6m
86+
- gaspard
8687
- Geist5000
8788
- gesposito
8889
- gianlucca

docs/start/tutorial.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ export default function Contact() {
271271
const contact = {
272272
first: "Your",
273273
last: "Name",
274-
avatar: "https://placekitten.com/g/200/200",
274+
avatar: "https://robohash.org/you.png?size=200x200",
275275
twitter: "your_handle",
276276
notes: "Some notes",
277277
favorite: true,
@@ -282,7 +282,7 @@ export default function Contact() {
282282
<div>
283283
<img
284284
key={contact.avatar}
285-
src={contact.avatar || null}
285+
src={contact.avatar || `https://robohash.org/${contact.id}.png?size=200x200`}
286286
/>
287287
</div>
288288

@@ -337,8 +337,7 @@ export default function Contact() {
337337
}
338338

339339
function Favorite({ contact }) {
340-
// yes, this is a `let` for later
341-
let favorite = contact.favorite;
340+
const favorite = contact.favorite;
342341
return (
343342
<Form method="post">
344343
<button
@@ -1718,7 +1717,7 @@ import {
17181717

17191718
function Favorite({ contact }) {
17201719
const fetcher = useFetcher();
1721-
let favorite = contact.favorite;
1720+
const favorite = contact.favorite;
17221721

17231722
return (
17241723
<fetcher.Form method="post">
@@ -1747,7 +1746,7 @@ Might want to take a look at that form while we're here. As always, our form has
17471746
import { getContact, updateContact } from "../contacts";
17481747

17491748
export async function action({ request, params }) {
1750-
let formData = await request.formData();
1749+
const formData = await request.formData();
17511750
return updateContact(params.contactId, {
17521751
favorite: formData.get("favorite") === "true",
17531752
});
@@ -1814,10 +1813,9 @@ The fetcher knows the form data being submitted to the action, so it's available
18141813
function Favorite({ contact }) {
18151814
const fetcher = useFetcher();
18161815

1817-
let favorite = contact.favorite;
1818-
if (fetcher.formData) {
1819-
favorite = fetcher.formData.get("favorite") === "true";
1820-
}
1816+
const favorite = fetcher.formData
1817+
? fetcher.formData.get("favorite") === "true"
1818+
: contact.favorite;
18211819

18221820
return (
18231821
<fetcher.Form method="post">

0 commit comments

Comments
 (0)