import React, {useState} from 'react'; type Props = { addRoom: (name: string) => void; } const NewRoomForm: React.FC = (props) => { const [name, setName] = useState(''); function addRoom(ev: React.FormEvent) { ev.preventDefault(); props.addRoom(name); setName(''); } return (
{setName(event.target.value)}} />
) } export default NewRoomForm;