Here I have a state which its initial value is an empty obj.
const [error, setError] = useState({});
In the next step, I'm checking if there is vacant input, set its key to the error state :
if (emptyInputs.length) {
emptyInputs.forEach(key => setError({ ...error, [key]: true }));
but only one of the empty inputs name sets to my error state:
is there anyone face to this problem?

emptyInputs..