import { useState } from 'react'; export default function FormSelect() { // State 초기화 const [form, setForm] = useState({ animal: 'dog' }); // 선택 상자 변경 시 입력값을 State에 반영 const handleForm = e => { setForm({ ...form, [e.target.name]: e.target.value }); }; // [보내기] 버튼 클릭 시 입력값 로그 출력 const show = () => { console.log(`좋아하는 동물:${form.animal}`); }; return (
); }