react-select
react-select copied to clipboard
the possibility to use react-select with form data
hell i am sending multipart/form-data through an api and using formdata to capture the key values of inputs,
const handleFormSubmit = (e) => {
e.preventDefault()
let formData = new FormData()
formData.append('name', name)
formData.append('price', price)
formData.append('description', description)
formData.append('tag', tag)
formData.append('stocks', stocks)
formData.append('category', categories)
formData.append('attribute', att)
for (let i = 0; i < images.length; i++) {
formData.append('images[]', images[i])
}
axios.defaults.withCredentials = true
axios.post('http://localhost:8000/api/products', formData, {
headers: {
'CouseApintent-Type': 'multipart/form-data',
},
})
}
i have retriveing the categories and attribute from an onChange function but the request returns 422
which means that these twol values were not captured since it was working before adding the react-select