Я пытаюсь загрузить изображение с помощью реакционных хуков
const [picture, setPicture] = useState();
const onChangePicture = e => {
console.log('picture: ', picture);
setPicture(...picture, e.target.files[0]);
};
<input
type="file"
//style={{ display: 'none' }}
onChange={e => onChangePicture(e)}
/>
, однако получаю следующую ошибку:
Uncaught TypeError: picture is not iterable
, когда я изменяю onChangePicture на
setPicture(picture, e.target.files[0])
переменная изображения не определена,
любая помощь будет оценена.