Hacker News new | ask | show | jobs
by mike_hearn 269 days ago
I didn't know that, thanks for the pointer, but ReactJS did start as a client side only framework.

React's history starts around 2010 or so, it was integrated into Facebook in 2011 and Instagram 2012 before being open sourced in 2013. And it was that first open source release that added renderComponentToString: long after React had been deployed on some of the world's largest websites.

Also, renderComponentToString isn't SSR. That term usually implies client side hydration so event handlers work, as React is all about state management. But in that release there is no mention of hydration. You could of course do it by hand by rendering to HTML server side, then replacing the entire DOM with a new client side rendered version yourself if you don't mind wiping user's state in some cases, which of course people do! For SSR to work properly took longer.

And that makes sense. Facebook don't use JS on the server side, at least not in that era, their web servers were all PHP/hack. So what would have done the SSR?

1 comments

Just as a fun fact, React’s jsx is actually a port of XHP which was initially developed for PHP in 2009 I believe. This would explain why react’s components were class based at first (because php leans heavily towards class based OO programming).