React is all the rage these days and IMHO developing websites feels a lot easier with React. Of course, you can use and favor other frameworks too but I'm gonna limit the context of this post to React affictionados.
- Component based
- Pre-configured (for most part) starter with create-react-app
- Faster development
- React is AWESOME 🎉
- DOM is constructed in the browser (client-side)
- SEO implications
- Higher Time to Interactive (TTI)
Let's get a little more into why all these things happen.
React loads the site into DOM after this line is invoked.
ReactDOM.render(<App />, document.getElementById('root'));
What this means it, the whole DOM, styles and behavior of the site is initialized only after the
bundle.js is loaded and executed.
Unfortunately that's how search engines look at your site during indexing. So if you create your site with just React, only your page title will be indexed and nothing else inside your React code will be indexed.
Other than SEO implications, loading your site without the DOM in the first load (paint) increases your TTI metric. If you could load the DOM in the first load before loading your scripts, you'll drastically improve the UX.
SSR Websites and Static Websites are two different things. SSR pages are rendered from a server on each request where as static pages are generated during build time.
Ideally, only event handlers and complementary data should be loaded and attached after the first render.
- If you are building a static public website, Gatsby will be the right tool.
- If you are building a website that has a login and a lot of server side logic, Next will be the right tool.
Of course there are a lot other options and reasons to choose your right tool but personally these two will be enough for most preliminary requirements.
Other points to argue
- You can create SSR pages with React but you will need to setup your server and everything manually. Next.js makes this whole process easier.
In other news, I'm totally smitten and unfathomably in love with Gatsby ❤️
Going forward, I'm planning to build all my side projects in Gatsby this year. I created a Gatsby starter boilerplate with added configurations over default Gatsby starter - Gatsby Boilerplate.
My Gatsby based sites so far
You are amazing! ✨
The first post in a series that explores what it means to write tests for our code. This introduction provides a high-level overview of various testing concepts; the goal is to build a common vocabulary for future posts.