@@ -8,7 +8,7 @@ The file-system is the main API. Every `.js` file becomes a route that gets auto
8
8
9
9
Populate ` ./pages/index.js ` inside your project:
10
10
11
- ```
11
+ ``` jsx
12
12
import React from ' react'
13
13
export default () => (
14
14
< div> Welcome to next .js ! < / div>
@@ -28,7 +28,7 @@ So far, we get:
28
28
29
29
Every ` import ` you declare gets bundled and served with each page
30
30
31
- ```
31
+ ``` jsx
32
32
import React from ' react'
33
33
import cowsay from ' cowsay'
34
34
export default () => (
@@ -42,7 +42,7 @@ That means pages never load unneccessary code!
42
42
43
43
We use [ Aphrodite] ( https://github.com/Khan/aphrodite ) to provide a great built-in solution for CSS modularization
44
44
45
- ```
45
+ ``` jsx
46
46
import React from ' react'
47
47
import { css , StyleSheet } from ' next/css'
48
48
@@ -66,7 +66,7 @@ const styles = StyleSheet.create({
66
66
67
67
We expose a built-in component for appending elements to the ` <head> ` of the page.
68
68
69
- ```
69
+ ``` jsx
70
70
import React from ' react'
71
71
import Head from ' next/head'
72
72
export default () => (
@@ -82,7 +82,7 @@ export default () => (
82
82
83
83
When state, lifecycle hooks or initial data population you can export a ` React.Component ` :
84
84
85
- ```
85
+ ``` jsx
86
86
import React from ' react'
87
87
export default class extends React .Component {
88
88
async getInitialProps ({ isServer, req }) {
@@ -105,7 +105,7 @@ Client-side transitions between routes are enabled via a `<Link>` component
105
105
106
106
#### pages/index.js
107
107
108
- ```
108
+ ``` jsx
109
109
import React from ' react'
110
110
import Link from ' next/link'
111
111
export default () => (
@@ -115,7 +115,7 @@ export default () => (
115
115
116
116
#### pages/about.js
117
117
118
- ```
118
+ ``` jsx
119
119
import React from ' react'
120
120
export default () => (
121
121
< p> Welcome to About! < / p>
@@ -141,7 +141,7 @@ Each top-level component receives a `url` property with the following API:
141
141
142
142
404 or 500 errors are handled both client and server side by a default component ` error.js ` . If you wish to override it, define a ` _error.js ` :
143
143
144
- ```
144
+ ``` jsx
145
145
import React from ' react'
146
146
export default ({ statusCode }) => (
147
147
< p> An error { statusCode } occurred< / p>
@@ -152,14 +152,14 @@ export default ({ statusCode }) => (
152
152
153
153
To deploy, run:
154
154
155
- ```
155
+ ``` bash
156
156
next build
157
157
next start
158
158
```
159
159
160
160
For example, to deploy with ` now ` a ` package.json ` like follows is recommended:
161
161
162
- ```
162
+ ``` json
163
163
{
164
164
"name" : " my-app" ,
165
165
"dependencies" : {
0 commit comments