- Static file serving. `./static/` is mapped to `/static/` (given you [create a `./static/` directory](#static-file-serving-eg-images) inside your project)
- Static file serving. `./static/` is mapped to `/static/` (given you [create a `./static/` directory](#static-file-serving-eg-images) inside your project)
To see how simple this is, check out the [sample app - nextgram](https://github.com/zeit/nextgram)
### Automatic code splitting
### Automatic code splitting
...
@@ -158,7 +157,6 @@ export default CowsayHi
...
@@ -158,7 +157,6 @@ export default CowsayHi
</ul>
</ul>
</details>
</details>
<p></p>
We bundle [styled-jsx](https://github.com/zeit/styled-jsx) to provide support for isolated scoped CSS. The aim is to support "shadow CSS" similar to Web Components, which unfortunately [do not support server-rendering and are JS-only](https://github.com/w3c/webcomponents/issues/71).
We bundle [styled-jsx](https://github.com/zeit/styled-jsx) to provide support for isolated scoped CSS. The aim is to support "shadow CSS" similar to Web Components, which unfortunately [do not support server-rendering and are JS-only](https://github.com/w3c/webcomponents/issues/71).
...
@@ -211,7 +209,6 @@ Please see the [styled-jsx documentation](https://www.npmjs.com/package/styled-j
...
@@ -211,7 +209,6 @@ Please see the [styled-jsx documentation](https://www.npmjs.com/package/styled-j
</ul>
</ul>
</details>
</details>
<p></p>
It's possible to use any existing CSS-in-JS solution. The simplest one is inline styles:
It's possible to use any existing CSS-in-JS solution. The simplest one is inline styles:
...
@@ -258,7 +255,6 @@ _Note: Don't name the `static` directory anything else. The name is required and
...
@@ -258,7 +255,6 @@ _Note: Don't name the `static` directory anything else. The name is required and
</ul>
</ul>
</details>
</details>
<p></p>
We expose a built-in component for appending elements to the `<head>` of the page.
We expose a built-in component for appending elements to the `<head>` of the page.
...
@@ -326,7 +322,6 @@ _Note: `<title>` and `<meta>` elements need to be contained as **direct** childr
...
@@ -326,7 +322,6 @@ _Note: `<title>` and `<meta>` elements need to be contained as **direct** childr
</ul>
</ul>
</details>
</details>
<p></p>
When you need state, lifecycle hooks or **initial data population** you can export a `React.Component` (instead of a stateless function, like shown above):
When you need state, lifecycle hooks or **initial data population** you can export a `React.Component` (instead of a stateless function, like shown above):
...
@@ -400,7 +395,6 @@ Next.js does not ship a routes manifest with every possible route in the applica
...
@@ -400,7 +395,6 @@ Next.js does not ship a routes manifest with every possible route in the applica
</ul>
</ul>
</details>
</details>
<p></p>
Client-side transitions between routes can be enabled via a `<Link>` component.
Client-side transitions between routes can be enabled via a `<Link>` component.
...
@@ -495,7 +489,6 @@ To inject the `pathname`, `query` or `asPath` in your component, you can use [wi
...
@@ -495,7 +489,6 @@ To inject the `pathname`, `query` or `asPath` in your component, you can use [wi
</ul>
</ul>
</details>
</details>
<p></p>
The component `<Link>` can also receive a URL object and it will automatically format it to create the URL string.
The component `<Link>` can also receive a URL object and it will automatically format it to create the URL string.
...
@@ -605,7 +598,6 @@ The default behaviour of `<Link>` is to scroll to the top of the page. When ther
...
@@ -605,7 +598,6 @@ The default behaviour of `<Link>` is to scroll to the top of the page. When ther
</ul>
</ul>
</details>
</details>
<p></p>
You can also do client-side page transitions using the `next/router`
You can also do client-side page transitions using the `next/router`
Shallow routing allows you to change the URL without running `getInitialProps`. You'll receive the updated `pathname` and the `query` via the `router` prop (injected using [`withRouter`](#using-a-higher-order-component)), without losing state.
Shallow routing allows you to change the URL without running `getInitialProps`. You'll receive the updated `pathname` and the `query` via the `router` prop (injected using [`withRouter`](#using-a-higher-order-component)), without losing state.
Typically you start your next server with `next start`. It's possible, however, to start a server 100% programmatically in order to customize routes, use route patterns, etc.
Typically you start your next server with `next start`. It's possible, however, to start a server 100% programmatically in order to customize routes, use route patterns, etc.
...
@@ -1063,7 +1051,6 @@ app.prepare().then(() => {
...
@@ -1063,7 +1051,6 @@ app.prepare().then(() => {
</ul>
</ul>
</details>
</details>
<p></p>
Next.js supports TC39 [dynamic import proposal](https://github.com/tc39/proposal-dynamic-import) for JavaScript.
Next.js supports TC39 [dynamic import proposal](https://github.com/tc39/proposal-dynamic-import) for JavaScript.
With that, you could import JavaScript modules (inc. React Components) dynamically and work with them.
With that, you could import JavaScript modules (inc. React Components) dynamically and work with them.
Next.js uses the `App` component to initialize pages. You can override it and control the page initialization. Which allows you to do amazing things like:
Next.js uses the `App` component to initialize pages. You can override it and control the page initialization. Which allows you to do amazing things like:
...
@@ -1262,7 +1248,6 @@ export default MyApp
...
@@ -1262,7 +1248,6 @@ export default MyApp
</ul>
</ul>
</details>
</details>
<p></p>
- Is rendered on the server side
- Is rendered on the server side
- Is used to change the initial server side rendered document markup
- Is used to change the initial server side rendered document markup
...
@@ -1541,7 +1526,6 @@ NODE_OPTIONS="--inspect" next
...
@@ -1541,7 +1526,6 @@ NODE_OPTIONS="--inspect" next
</ul>
</ul>
</details>
</details>
<p></p>
Some commonly asked for features are available as modules:
Some commonly asked for features are available as modules:
...
@@ -1579,7 +1563,7 @@ module.exports = {
...
@@ -1579,7 +1563,7 @@ module.exports = {
// Note: we provide webpack above so you should not `require` it
// Note: we provide webpack above so you should not `require` it
// Perform customizations to webpack config
// Perform customizations to webpack config
// Important: return the modified config
// Important: return the modified config
// Example using webpack option
// Example using webpack option
config.plugins.push(
config.plugins.push(
new webpack.IgnorePlugin(/\/__tests__\//),
new webpack.IgnorePlugin(/\/__tests__\//),
...
@@ -1636,7 +1620,6 @@ module.exports = {
...
@@ -1636,7 +1620,6 @@ module.exports = {
</ul>
</ul>
</details>
</details>
<p></p>
In order to extend our usage of `babel`, you can simply define a `.babelrc` file at the root of your app. This file is optional.
In order to extend our usage of `babel`, you can simply define a `.babelrc` file at the root of your app. This file is optional.
...
@@ -1892,7 +1875,6 @@ The [polyfills](https://github.com/zeit/next.js/tree/canary/examples/with-polyfi
...
@@ -1892,7 +1875,6 @@ The [polyfills](https://github.com/zeit/next.js/tree/canary/examples/with-polyfi
</ul>
</ul>
</details>
</details>
<p></p>
`next export` is a way to run your Next.js app as a standalone static app without the need for a Node.js server.
`next export` is a way to run your Next.js app as a standalone static app without the need for a Node.js server.
The exported app supports almost every feature of Next.js, including dynamic urls, prefetching, preloading and dynamic imports.
The exported app supports almost every feature of Next.js, including dynamic urls, prefetching, preloading and dynamic imports.
...
@@ -2022,7 +2004,6 @@ The `req` and `res` fields of the `context` object passed to `getInitialProps` a
...
@@ -2022,7 +2004,6 @@ The `req` and `res` fields of the `context` object passed to `getInitialProps` a
</ul>
</ul>
</details>
</details>
<p></p>
A zone is a single deployment of a Next.js app. Just like that, you can have multiple zones. Then you can merge them as a single app.
A zone is a single deployment of a Next.js app. Just like that, you can have multiple zones. Then you can merge them as a single app.
...
@@ -2080,7 +2061,6 @@ We’re ecstatic about both the developer experience and end-user performance, s
...
@@ -2080,7 +2061,6 @@ We’re ecstatic about both the developer experience and end-user performance, s
</details>
</details>
<p></p>
<details>
<details>
<summary>How big is it?</summary>
<summary>How big is it?</summary>
...
@@ -2090,7 +2070,6 @@ A small Next main bundle is around 65kb gzipped.
...
@@ -2090,7 +2070,6 @@ A small Next main bundle is around 65kb gzipped.
</details>
</details>
<p></p>
<details>
<details>
<summary>Is this like `create-react-app`?</summary>
<summary>Is this like `create-react-app`?</summary>
...
@@ -2113,7 +2092,6 @@ If you want to create re-usable React components that you can embed in your Next
...
@@ -2113,7 +2092,6 @@ If you want to create re-usable React components that you can embed in your Next
</details>
</details>
<p></p>
<details>
<details>
<summary>How do I use CSS-in-JS solutions?</summary>
<summary>How do I use CSS-in-JS solutions?</summary>