'Error: The style prop expects a mapping from style properties to values, not a string when onUploadProgress axios React
i have a redux action to upload image
const uploadDokumen = (file) => async (dispatch) => {
try {
const data = new FormData()
data.append('file', file)
data.append('upload_preset', 'xxxxxx')
data.append('cloud_name', 'xxxxxxx')
const postDataDokumen = await CloudinaryAPI({
method: 'POST',
url: '/image/upload',
data: data,
onUploadProgress: (data) => {
let progress = Math.round((data.loaded * 100) / data.total)
dispatch(setImageProgress(progress))
}
})
dispatch(setUrlDokumen(postDataDokumen.data.url))
} catch (error) {
console.log(error.response)
}
}
but when i trigger this action, it return error
Error: The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.
the error refers to dispatch dispatch(setImageProgress(progress))
need your help, i dont know what happened
thank you
Solution 1:[1]
Check your html code where style props are declared. For i.e:
- Try adding {} to style props.
- Try removing "" from style props.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | martinsbleu |