Back to articles
A Few Things I Learned While Working with Next.js in Real Projects
How-ToTools

A Few Things I Learned While Working with Next.js in Real Projects

via Dev.toYogesh Kumar

Hi everyone, After working mostly with React projects, I recently spent more time working with Next.js in production applications. I liked many things about it, but I also learned a few lessons while building real features. I thought I would share a few of them. 1. Folder structure becomes important very quickly When a Next.js project is small, everything feels simple. But as the project grows, it can become messy if there is no clear structure. In one project we had pages, components, hooks, and API logic mixed in many places. Later we organized things better: components hooks services utilities It made the code much easier to navigate for the team. 2. Server vs Client components can be confusing at first One thing that confused me in the beginning was when to use server components and when to use client components. Sometimes I accidentally used a hook in a server component and the build failed. After some time I started following a simple rule: Server components for data and layout C

Continue reading on Dev.to

Opens in a new tab

Read Full Article
2 views

Related Articles