futurice/pepperoni-app-kit

Global States without immutable.js ?

ludescher opened this issue · 1 comments

Is there a way, to store states globally.
I know you can use immutable.js, which is described in the docs,
but i need to store data for just a few seconds, not persistent.

Hi! If you are looking to store some data across your app and you are not concerned about immutability etc then perhaps try something like this configuration file:

https://github.com/futurice/pepperoni-app-kit/blob/master/src/utils/configuration.js

Replace let configuration = Map(); with let configuration = {} to use a regular JS object instead of the immutable Map, and then change the various functions to modify and share that instead. Said functions can then be imported wherever you need.

Hope this helps!