News for hackers. Stuff that matters.
Re:React JS Best Practices by tel on Saturday May 09, 2015 @12:23PM (#9516792)
This is probably obvious but why is the existence of singletons what destroys "isomorphism"?
Re:React JS Best Practices by billybolero on Saturday May 09, 2015 @03:54PM (#9517482)
Because that singleton will serve multiple requests on the server, requests from different users. Singletons are more okay on the client because you know you'll only serve one user, so the singleton can make that assumption as well. But that doesn't work on the server, since the singleton is serving more than one user.

You can still use singletons on the server, but you have to pass the current user id to every method/event on that singleton. And that ends up being quite annoying.

Re:React JS Best Practices by tel on Saturday May 09, 2015 @05:05PM (#9517687)
Ah, I see. Thanks.
Re:React JS Best Practices by efdee on Sunday May 10, 2015 @12:09PM (#9520303)
On the serverside, your stores should not be singletons (shared between all requests) but in request scope (one per request). Otherwise users will be reading eachother's data.