import { useState } from 'react' const ShowPerson = (props) => { const persons = props.persons return (
    {persons.map( (person) => { return (
  1. {person.name}
  2. ) } )}
) } const App = () => { const [persons, setPersons] = useState([ { name: 'Arto Hellas' } ]) const [newName, setNewName] = useState('') const addNumber = (event) => { event.preventDefault() console.log(newName, persons) const newPerson = { name: newName, id: persons.length + 1, } setPersons(persons.concat(newPerson)) } const handleTypedName = (event) => { console.log(event.target.value) setNewName(event.target.value) console.log(newName) } return (

Phonebook

name:

Numbers

) } export default App