const [value, setValue] = React.useState(prediction); return ( <> e.target.checkValidity() ? setValue(e.target.valueAsNumber) : undefined } /> setPrediction?.(value)} /> // 入力欄 import * as React from "react"; type Props = { prediction: number; onSubmit?: (prediction: number) => void; max?: number; min?: number; }; export const Guess = ({ prediction, onSubmit: setPrediction, max, min }: Props) => { const [value, setValue] = React.useState(prediction); return ( <> e.target.checkValidity() ? setValue(e.target.valueAsNumber) : undefined } /> setPrediction?.(value)} /> > ); };