setState((prev)=>{
//do something
return [...prev]
})
{initialState.map((el, idx) => (
<input
onChange={(e) => showValue(e.target.value, idx)}
key={el.placeholder}
placeholder={el.placeholder}
type={el.type}
/>
))}
const showValue = (value, index) => {
setState((prev)=>{
prev[index].value = value
return [...prev]
})
};