Nextjs - Navigating the New App Router and Unveiling SEO Advantages
I have created this blog app in nextJs.
There were two main motives why I ever started creating this project is
first, I wanted to get acquainted with the new app router and understand its core features and second, I wanted to build something that would hold me through out the process and a blog app was all I came of at that time.
The greatest advantage of using nextJs is its well rounded SEO and optimizations it offers us. Web apps built on it are fast and are great at being crawled by search engines.
However, it was challenging at first to begin with, because there were some planning that needed to be done before thinking about any component and the whole app. I had to plan about what components do I keep as server and what as client. Although it offers us flexibility in considering it but it has some rules that we need to pay heed to everytime we think of a component
For example, if we want to make a component client, we will have to use that component with “use client” at top.And after doing so we get this flexibility to use all the functions such as useState, useEffects, click events like any normal react component. On the contrary, we will have the restrictions to use these functions on the server components.
So, if we want to create a server page but we also want to use these functions, we will have to break our component into further sub-component and import that into our main component.