import * as React from "react"; import { options } from "./options"; export const Questionaire = ({ question }: { question: string }) => { const [val, setVal] = React.useState(options[0].value); const [text, setText] = React.useState(""); const getAnswer = () => (val === "" ? text : val); const handleChange = (e: React.ChangeEvent) => setVal(e.target.value); const onTextChanged = (e: React.ChangeEvent) => setText(e.target.value); return ( <>

{question}

{options.map((option) => ( ))}


回答: {getAnswer()}

); };