我正在使用扩展运算符遍历 Maps 对象的键,并且想知道如何从状态中派生值。
const [data, setData] = useState(
new Map(
Object.entries({
datapoint1: "",
datapoint2: "",
datapoint3: "",
datapoint4: ""
})
)
);
{[...data.keys()].map((datapoint) => {
return (
<input
className="inputboxes"
id={datapoint}
// value={} how to get value
key={datapoint}
onChange={handleChange(datapoint)}
/>
);
}
)}