Introduction to Next JS - React framework
In a recent article I gave an introduction to React. That article shows the first steps of building React components, but leaves us very far from building a useful web application. In this article we will learn how to create a real world application using Next JS.
Next JS
Next JS sells itself as the “React framework for production”. They promise smooth user experience combined with a rich set of features to build fast apps.
Environment set-up
To start an application from scratch we can use their generator:
1
npx create-next-app
We will be prompted for a name. I’ll use example
for my app.
When the command finishes, we can start our app in development mode:
1
npm run dev
What we get out of the box:
- Compilation and bundling (Babel and webpack)
- Auto-refresh on changes
- Static Site Generation (SSG) and Server Side Rendering (SSR)
- Server of static files (Files under
/public/
)