Thore
Thore

Reputation: 1838

Adding File Object to redux store results in empty property object

I'm trying to add a File Object to my Redux store.

My reducer looks like this:

...
case 'SET_INVOICE':
  console.log(action.invoice); //File Object
  return { ...state, invoice: action.invoice};
...

Instead of the File Object added to the Redux store, the result is an empty object invoice: { }

Upvotes: 3

Views: 1522

Answers (2)

Yunus ER
Yunus ER

Reputation: 2189

It looks empty on devtool but it's not! Try to show redux store data in console log, you will see that it is not empty

Upvotes: 0

Tan Kim Loong
Tan Kim Loong

Reputation: 1035

Redux only stores datatype that is serializable, and File is not one of them. Try storing ES6 Map or Set. They will both appear as empty object as well.

Upvotes: 1

Related Questions