I have an error when I want to save to the redux state. A non-serializable value.
ivkeMilioner
Posted on August 22, 2022
I have an error when I want to save to the redux state.
A non-serializable value was detected in action, in the path: payload. picture. Value: FileList {0: File, length: 1}
Take a look at the logic that dispatched this action: {type: 'books/addToListOfBooks', payload: {…}}
<input
type="file"
{...register('picture', {
validate: {
lessThan10MB: (files) =>
files[0]?.size < 1024 * 1024 || 'Max 1MB',
acceptedFormats: (files) => {
const pictureType = files[0]?.name
.toLowerCase()
.split('.')
.pop()
return (
['jpeg', 'png', 'gif'].includes(pictureType) ||
'Only PNG, JPEG e GIF'
)
},
},
💖 💪 🙅 🚩
ivkeMilioner
Posted on August 22, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
help I have an error when I want to save to the redux state. A non-serializable value.
August 22, 2022