But when we do it purely in the browser, we have to make quite a few concessions: search engines have a hard time indexing that content, for example. It also takes longer for users to see the rendered content (not in every case, but in many, many cases.) Also if you're using a lot of plugins for your favorite library, or a heavyweight MVC framework, sometimes it can slow down interactivity.
I've thought for a long time (and blogged about it previously) that the ideal solution would fully render the markup on the server, deliver it to the client so that it can be shown to the user instantly. Then it would asynchronously load some Javascript that would attach to the rendered markup, and invisibly promote the page into a full app that can render its own markup. This code would also have to be fast enough to meet or exceed the performance of other modern solutions, or it won't be worth it.
What I've discovered is that enough of the pieces have come together, that this futuristic-sounding web environment is actually surprisingly easy to do now with React.js. React isn't a full-fledged framework, it's a library, so you'll have to build your own foundation and write some glue code. I've been rewriting an existing website in React (usually a terrible idea, we'll see about this time), and now that the code is settling down a little bit, I'd like to share how it works. This post will just be an overview, but up next I'll share some of my glue code and lessons learned etc.
Your new post is loading...