Answer the question
In order to leave comments, you need to log in
React, how to properly load images?
Hello, I can't figure out how to solve this problem.
There is such a state
const [form, setForm] = useState({
name: "", price: "", weight: "", productImage: "", category: ""
})
const onChangeHandler = event => {
setForm({...form, [event.target.name] : event.target.value})
}
const onChangeHandler = event => {
if(event.target.files){
const file = event.target.files[0]
console.log(file)
}
setForm({...form, [event.target.name] : event.target.value})
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question