DEV Community

Cover image for Starting out: Vite or Next JS for React JS
TobiLean
TobiLean

Posted on

Starting out: Vite or Next JS for React JS

Anyone looking to become a full-fledged front-end developer will come across something called a framework. A front-end framework creates a structure to help developers efficiently create a user interface.

What does that have to do with this article? A common misconception is that React is a framework. React can actually be seen as a JavaScript library. The difference is not gaping, but it is good to note it to avoid confusion. The React library provides a collection tools that help developers create and render more responsive and interactive user interface.

Photo by RealToughCandy.com: https://www.pexels.com/photo/hand-holding-react-sticker-11035471/

In this article I will compare two popular React JS tools, Vite and Next JS. Vite is a react bundler and build tool, and Next JS is a JavaScript framework built on react. We are we comparing the two because selecting one of them to start with after getting into React JS is a common choice among beginner front-end developers.

About Vite

Vite was created about 4 years ago and since then it has gained a lot of track making it one of the common choices for developers. I started to use Vite after I tried my hands with create react app, and my experience so far has been very smooth.

About Next JS

Next JS is a web development framework based on React JS. It was initially released in 2016 is currently one of the more popular React JS frameworks wit over 1 million monthly developers according to Next JS (see: https://nextjs.org/blog/next-14-2).

Differences and Similarities

How do these two compare? While the most obvious difference between them is that Vite is a bundler and build tool, which means it helps tie your various resources (CSS, HTML, JavaScript etc.) into a single file and helps to scaffold your React JS project. But Next JS does more than that, it handles, building, bundling, routing, optimization etc. It can be used for server-side rendering and SEO, it is a framework. Clearly Next JS is more powerful and has some extra things built on top React JS. But does more power equal better?

Some technical differences

Besides the technical differences, there are other factors like their learning curve, and community support. They both have a reasonably sized community, good documentation and many friendly non-toxic developers (based on my experience). Although Next JS has been here longer and has more features, so it tends to be the better known of the two. There is a difference in how easy it is to learn and practice though. Vite is regarded be many as a “proper” way to learn react. It doesn’t have any additional functionality in the same manner that Next JS does. Learning Next JS on the other hand is more demanding and feels like a whole different environment.

The choice

So, which one should beginners in React JS choose. In my opinion it is always going to be Vite, your can learn React JS starting with Vite, you do not have to necessarily learn React JS using CDN or create-react-app. But going through Next JS first would prove difficult and might not be the best foundation for novice front-end developers.

While delving deeper into your journey into front-end development as a beginner, you would be faced with so many options not even covered in this article and you would have to pick one if you want to stay relevant in this industry as many employers have already long adopted these modern tools and are heavily reliant on them. It has become imperative to at least have basic knowledge in multiple tools and frameworks and master at the very least one of them. With the rising popularity of the React JS library many companies are looking for talent in that area and withing the world of React there are still more frameworks and tools to choose from. If you decide to learn react, I would advise to use Vite over create-react-app and before you learn Next JS (if you decide to).

Conclusion

In conclusion, learning takes time and sometimes as beginners you might need more guidance than just what an article can provide, that is why other than just reading and practicing it is good to join a community or internship program like the HNG internship (https://hng.tech/internship) which offers both an internship and a community which you can have longer access to if you subscribe to HNG premium (https://hng.tech/premium). I myself am taking part of this internship. It is good to surround yourself with people with similar goals, in order to not be alone on your developer journey.


cover photo by Nick Gorniok : https://www.pexels.com/photo/scaffolding-on-building-wall-17925400/

Top comments (2)

Collapse
 
leankhan profile image
LeanKhan

Good article for anyone getting started with React in 2024. As Create React App is no longer the preferred way to work with React it becomes confusing to pick a tool. Thanks for writing it

Collapse
 
fauziyat_gimbiyatsadiq_2 profile image
Fauziyat Gimbiyat Sadiq

A great read.