https://github.com/zeit/next.js/
Next.js is a minimalistic framework for server-rendered React applications.
Next.js was open-sourced 25th October 2016. The company behind Next is called ZEIT.
Next.js is backed by an organization which is stable and is also very active in the open-source world. Next is not going away in a couple months and most likely is here to stay.
So there you go – we’re officially in the age of server side rendered react apps. A lot of questions pop up, for example
Great question — we should always be open to new concepts and learning new things. Remember, being a developer means being a student for life. Next can improve your life as a developer.
Imagine asking “why should I care” each time when a new technology comes out. We would be stuck with 90’s development tooling if that was the case.
When jQuery came out (it was a revolution due it’s ease of use) — you could have asked “why care at all?” and just keep on using vanilla Javascript. But you got to admit it improved almost every code base and made life just a little bit easier for all of us.
At the end, innovation will win — why not be an early adopter? 🤗
Curious about the benefits? Here’s a full in-depth article explaining the details.
Client side rendering — Normally when using React, your browser will download a minimal HTML page, and the content will be filled in by JavaScript.
With Server side rendering, the initial content is generated on the server, so your browser can download a page with HTML content already in place. Updates to the content are still handled in the browser.
Very useful article about server side benefits and when to use — when not to use!
We start our Next.js project like any other Node project. All you need to do is install Next as a npm module. Paste this command in the terminal.
After successfully starting our node project, installing react, react-dom and next — open the project with your text editor/IDE**.** Add the next script (see line number 7)
dev
script!
And that’s it! We successfully installed Next. Notice how ridiculously easy it was to get started?
We have React, webpack, hot module loading, routing, server side rendering, pre-fetching— and many more goodies which are a pain to setup right out of the box!
Okay — You’re probably questioning why is Next showing us a 404 page?
Well.. that’s because we haven’t made a page yet!
Let’s create our first component inside pages/index.js
Notice how we don’t need to import React — and how Next picked up routing? Try adding another paragraph — we also have hot module reloading!
Beautiful.
If you view the source of our app — here’s what we should be seeing.
This is Next doing it’s magic. Our React app is server side rendered.
Cool! This is more a introduction to what is server side rendering — why it can be useful — and how to get the ball rolling with Next.
Go through this great Next tutorial to unleash all of it’s powerful features.
Thanks for reading and I hope you learned as much as I did! ❤