Best way to store file objects in React Redux store (files upload from DropZone?) Best way to store file objects in React Redux store (files upload from DropZone?) reactjs reactjs

Best way to store file objects in React Redux store (files upload from DropZone?)


One of the key rules of Redux is that non-serializable values should not go into the store. Because of that, file objects should not be kept in the Redux store if at all possible.


I had a similar problem and ended up using this:

URL.createObjectURL(file)

It returns a url like blob:http://example.com/f331074d-a7f3-4972-9c37-96b490a4dd96 which is just a string and can be used in img tag's src attribute. Not sure what Material Ui dropzone returns, but this works with File objects returned by <input type="file" />