@@ -271,7 +271,7 @@ export default function Contact() {
271
271
const contact = {
272
272
first: " Your" ,
273
273
last: " Name" ,
274
- avatar: " https://placekitten.com/g/200/200 " ,
274
+ avatar: " https://robohash.org/you.png?size=200x200 " ,
275
275
twitter: " your_handle" ,
276
276
notes: " Some notes" ,
277
277
favorite: true ,
@@ -282,7 +282,7 @@ export default function Contact() {
282
282
< div>
283
283
< img
284
284
key= {contact .avatar }
285
- src= {contact .avatar || null }
285
+ src= {contact .avatar || ` https://robohash.org/ ${ contact . id } .png?size=200x200 ` }
286
286
/ >
287
287
< / div>
288
288
@@ -337,8 +337,7 @@ export default function Contact() {
337
337
}
338
338
339
339
function Favorite ({ contact }) {
340
- // yes, this is a `let` for later
341
- let favorite = contact .favorite ;
340
+ const favorite = contact .favorite ;
342
341
return (
343
342
< Form method= " post" >
344
343
< button
@@ -1718,7 +1717,7 @@ import {
1718
1717
1719
1718
function Favorite ({ contact }) {
1720
1719
const fetcher = useFetcher ();
1721
- let favorite = contact .favorite ;
1720
+ const favorite = contact .favorite ;
1722
1721
1723
1722
return (
1724
1723
< 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
1747
1746
import { getContact , updateContact } from " ../contacts" ;
1748
1747
1749
1748
export async function action ({ request, params }) {
1750
- let formData = await request .formData ();
1749
+ const formData = await request .formData ();
1751
1750
return updateContact (params .contactId , {
1752
1751
favorite: formData .get (" favorite" ) === " true" ,
1753
1752
});
@@ -1814,10 +1813,9 @@ The fetcher knows the form data being submitted to the action, so it's available
1814
1813
function Favorite ({ contact }) {
1815
1814
const fetcher = useFetcher ();
1816
1815
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 ;
1821
1819
1822
1820
return (
1823
1821
< fetcher .Form method= " post" >
0 commit comments