Hi, I'm Ankita. Have you ever wondered what it takes to build a lightning-fast website? Well, I'm going to show you in this presentation. My topic is, Build a Lightning-Fast Site with Next.js, GraphQL, and Tailwind.
Hi again, I'm Ankita. I have been working in the industry for more than a decade now, a skill and architect at many apps with millions of clients, and I'm currently a creator with over 10,000 students online. It's extremely important to pick the right tools for the job, because without that, how do we even build a performance site? So you do need the right tools, just like the SpongeBob image here. And with Next.js, GraphQL and Tailwind, it is honestly a really power combo, because it will really help you to build a performance site.
So first, very quickly, what is Next.js? It is React framework for production. It gives you a lot of tooling out of the box, so you don't have to build a lot from scratch, such as routing and performance, everything is, Next.js is something that thinks about it from the get-go. Let's look at the rendering techniques in Next.js. And this is why, this is one of the biggest reasons why Next.js does add a lot of performance, and it helps with a lot of performance in general. So this is a very simple web image, for example, and you can see there are three different rendering techniques, such as static side regeneration, incremental side regeneration, and server side rendering. All these specific techniques have different ways you can cache data, for example, in static, if your site is completely static, you can cache all that data at build time and it will be available for you. Whereas in ISR, which is incremental side regeneration, you can say after how long you want the data to be cached, and in server side rendering, you are requesting that data over and over again. It's also really good for SEO, because the HTML is also going to be available for you right before, so when the bot is crawling your site, it is going to rack higher because of that as well. So in the first image, we are caching the three countries, but not Mexico. In incremental site regeneration, we do want a dynamic requirement for Mexico. And lastly, in server side rendering, all the pages and all the country pages are being re-rendered.
All right, so performance with Next.js. These are very cool and extremely important for you to check it out. I find that a lot of developers don't do that, so definitely checking this out for really building a lightning fast site. So for example, dynamic imports. In this case, we have a model here, right? And in the model case, we are using a dynamic import. So you can only choose to load the model when it's actually needed, when it's not needed, don't load it. Second is deferring non-essential scripts. Next.js gives us a script component to us. And you can see that over here, I'm only loading convertKit, which is something that I use for my newsletter, and I'm only loading it after the page is fully loaded using after interactive property. It's a React component, right? It looks like a React component. So it makes it really easy for us because why should I wait for my newsletter script to load when my entire site is ready to go? Second, third is Next.js image component. You might have heard about image component in general.
Comments