Where is it better to store image data in react/redux app?

Viewed 3418

There is an application on React/Redux, which has the functionality to load images through FileReader. After the image is loaded, I get it as dataUrl. So, where is it better to save this data to use it in several React components? To store a relatively large amount of data in the Redux Store seems like a bad idea. At the same time, if the image data is saved somewhere else, the idea "one source of true" breaks. Does anyone have any suggestions?

1 Answers

I'd suggest creating an Object URL instead of a dataUrl, then saving that in the store, as it won't be a huge string anymore. Don't forget to revoke them when you don't need them anymore if possible.

Related