News for hackers. Stuff that matters.
Re:Flux Comparison by Example by Touche on Tuesday February 03, 2015 @11:02AM (#8991057)
All JavaScript modules are singletons regardless of the format. But it's still a very common practice to export a constructor function as the module's value and then to instantiate new instances. No idea why that hasn't been followed with React, but I imagine that you are correct about the Facebook example. They should have put more care into making it correct rather than just making it simple to explain.
Re:Flux Comparison by Example by acdlite on Tuesday February 03, 2015 @12:08PM (#8991530)
Yep, that's what I was trying to say. The require cache makes the singleton pattern extra alluring, even in cases where you should avoid it.