Commit 66518b42 authored by Guillermo Rauch's avatar Guillermo Rauch Committed by GitHub

Update Readme.md

parent ebecbcf8
# next.js # next.js
`Next.js` is a minimalistic framework for server-rendered React applications. Next.js is a minimalistic framework for server-rendered React applications.
## How to use ## How to use
The file-system is the main API. Every `.js` file becomes a route that gets automatically processed and rendered. Install it:
```
$ npm install next --save
```
After that, the file-system is the main API. Every `.js` file becomes a route that gets automatically processed and rendered.
Populate `./pages/index.js` inside your project: Populate `./pages/index.js` inside your project:
...@@ -219,16 +225,14 @@ Yes and No. ...@@ -219,16 +225,14 @@ Yes and No.
Yes in that both make your life easier. Yes in that both make your life easier.
No in that it enforces a _structure_ so that we can do more advanced things like: No in that it enforces a _structure_ so that we can do more advanced things like:
- Server side rendering - Server side rendering
- Automatic code splitting - Automatic code splitting
In addition, Next.js provides two built-in features that are critical for every single website: In addition, Next.js provides two built-in features that are critical for every single website:
- Routing with lazy component loading: `<Link>` (by importing `next/link`) - Routing with lazy component loading: `<Link>` (by importing `next/link`)
- A way for components to alter `<head>`: `<Head>` (by importing `next/head`) - A way for components to alter `<head>`: `<Head>` (by importing `next/head`)
Next is not suitable right now for creating reusable components that every single React app can use. But we consider that a feature, since your re-usable components should live in separate repositories and then `import`ed.
In the future, we might consider a `next export` feature that produces a re-usable build of a component, to take advantage of Glamor and our simple and easy-to-use build system. If you want to create re-usable React components that you can embed in your Next.js app or other React applications, using `create-react-app` is a great idea. You can later `import` it and keep your codebase clean!
</details> </details>
...@@ -256,7 +260,7 @@ It also means fewer dependencies and fewer things for Next to do. Everything is ...@@ -256,7 +260,7 @@ It also means fewer dependencies and fewer things for Next to do. Everything is
Since every class name is invoked with the `css()` helper, Next.js can intelligently add or remove `<style>` elements that are not being used. Since every class name is invoked with the `css()` helper, Next.js can intelligently add or remove `<style>` elements that are not being used.
This is important for server-side rendering, but also during the lifecycle of the page. Since `Next.js` enables `pushState` transitions that load components dynamically, unnecessary `<style>` elements would bring down performance over time. This is important for server-side rendering, but also during the lifecycle of the page. Since Next.js enables `pushState` transitions that load components dynamically, unnecessary `<style>` elements would bring down performance over time.
This is a very signifcant benefit over approaches like `require(‘xxxxx.css')`. This is a very signifcant benefit over approaches like `require(‘xxxxx.css')`.
...@@ -316,7 +320,7 @@ It’s up to you. `getInitialProps` is an `async` function (or a regular functio ...@@ -316,7 +320,7 @@ It’s up to you. `getInitialProps` is an `async` function (or a regular functio
<details> <details>
<summary>Why does it load the runtime from a CDN by default?</summary> <summary>Why does it load the runtime from a CDN by default?</summary>
We intend for `Next.js` to be a great starting point for any website or app, no matter how small. We intend for Next.js to be a great starting point for any website or app, no matter how small.
If you’re building a very small mostly-content website, you still want to benefit from features like lazy-loading, a component architecture and module bundling. If you’re building a very small mostly-content website, you still want to benefit from features like lazy-loading, a component architecture and module bundling.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment