DEV Community

Discussion on: Singleton in JavaScript

Collapse
 
juanlanus profile image
Juan Lanus

My application has a potentially very long list of materials, to be used anywhere within the ReactJS components hierarchy.
I want to load it only once, and to have it available everywhere.

For this purpose I'm writing an ES6 class to be instantiated as a singleton, sitting in global state with reactn.
This post clarified the way to code the singleton thimg, big time.