Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hola-soy-milk authored Feb 21, 2024
1 parent 497d8b0 commit 69a3fd3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,8 @@ const styles = StyleSheet.create({
});

export default function NewGuest() {
const [firstName, onFirstName] = useState('');
const [lastName, onLastName] = useState('');
const [firstName, setFirstName] = useState<string>('');
const [lastName, setLastName] = useState<string>('');
return (
<>
<TextInput
Expand Down Expand Up @@ -652,12 +652,15 @@ In `app/index.tsx`, let's adapt our `useEffect` callback:
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ firstName, lastName }),
body: JSON.stringify({
firstName: guest.firstName,
lastName: guest.lastName,
}),
});
const newGuest: Guest = await response.json();
setGuests([...guests, newGuest]);
setGuests((g) => [...g, newGuest]);
}
loadGuests();
loadGuests().catch(console.error);

if (typeof firstName === 'string' && typeof lastName === 'string') {
postGuest({ firstName, lastName });
Expand Down

0 comments on commit 69a3fd3

Please sign in to comment.