You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: examples/amp/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -39,4 +39,4 @@ now
39
39
40
40
## The idea behind the example
41
41
42
-
This example shows how to create AMP pages using Next.js and the experimental AMP feature. It shows a normal page (non-AMP), an AMP only page, and a hybrid AMP page.
42
+
This example shows how to create AMP pages using Next.js and the experimental AMP feature. It shows a normal page (non-AMP), an AMP only page, and a hybrid AMP page.
Copy file name to clipboardexpand all lines: examples/custom-server-koa/README.md
+2-5
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,6 @@ Because the Next.js server is just a node.js module you can combine it with any
45
45
46
46
The example shows a server that serves the component living in `pages/a.js` when the route `/b` is requested and `pages/b.js` when the route `/a` is accessed. This is obviously a non-standard routing strategy. You can see how this custom routing is being made inside `server.js`.
47
47
48
-
49
48
## Side note: Enabling gzip compression
50
49
51
50
The most common Koa middleware for handling the gzip compression is [compress](https://github.com/koajs/compress), but unfortunately it is currently not compatible with Next.<br>
@@ -54,10 +53,8 @@ The most common Koa middleware for handling the gzip compression is [compress](h
54
53
If you need to enable the gzip compression, the most simple way to do so is by wrapping the express-middleware [compression](https://github.com/expressjs/compression) with [koa-connect](https://github.com/vkurchatkin/koa-connect):
Copy file name to clipboardexpand all lines: examples/parameterized-routing/README.md
-1
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,6 @@ yarn dev
33
33
34
34
See now documentation [here](https://zeit.co/docs/v2/deployments/routes/) and Next.js example [here](https://zeit.co/examples/nextjs/) for info on deploying with [now](https://zeit.co/now) ([download](https://zeit.co/download))
35
35
36
-
37
36
## The idea behind the example
38
37
39
38
Next.js allows [Custom server and routing](https://github.com/zeit/next.js#custom-server-and-routing) so you can, as we show in this example, parametrize your routes. What we are doing in `server.js` is matching any route with the pattern `/blog/:id` and then passing the id as a parameter to the `pages/blog.js` page.
Copy file name to clipboardexpand all lines: examples/shared-modules/README.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -41,5 +41,5 @@ now
41
41
42
42
This example features:
43
43
44
-
* An app with two pages which has a common Counter component
45
-
* That Counter component maintain the counter inside its module. This is used primarily to illustrate that modules get initialized once and their state variables persist in runtime
44
+
- An app with two pages which has a common Counter component
45
+
- That Counter component maintain the counter inside its module. This is used primarily to illustrate that modules get initialized once and their state variables persist in runtime
Copy file name to clipboardexpand all lines: examples/with-algolia-react-instantsearch/README.md
+2
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,7 @@ cd with-algolia-react-instantsearch
22
22
```
23
23
24
24
Set up Algolia:
25
+
25
26
- create an [algolia](https://www.algolia.com/) account or use this already [configured index](https://community.algolia.com/react-instantsearch/Getting_started.html#before-we-start)
26
27
- update the appId, apikey and indexName you want to search on in components/app.js
27
28
@@ -42,6 +43,7 @@ now
42
43
```
43
44
44
45
## The idea behind the example
46
+
45
47
The goal of this example is to illustrate how you can use [Algolia React InstantSearch](https://community.algolia.com/react-instantsearch/) to perform
46
48
your search with a Server-rendered application developed with Next.js. It also illustrates how you
Copy file name to clipboardexpand all lines: examples/with-apollo-and-redux-saga/README.md
+10-3
Original file line number
Diff line number
Diff line change
@@ -38,19 +38,26 @@ now
38
38
```
39
39
40
40
## The idea behind the example
41
+
41
42
In 2.0.0, Apollo Client severs out-of-the-box support for redux in favor of Apollo's client side state management. This example aims to be an amalgamation of the [`with-apollo`](https://github.com/zeit/next.js/tree/master/examples/with-apollo) and [`with-redux-saga`](https://github.com/zeit/next.js/tree/master/examples/with-redux-saga) examples.
42
43
43
44
Note that you can access the redux store like you normally would using `react-redux`'s `connect`. Here's a quick example:
`connect` must go inside `withReduxSaga` otherwise `connect` will not be able to find the store.
54
60
55
61
### Note:
56
-
In these *with-apollo* examples, the ```withData()``` HOC must wrap a top-level component from within the ```pages``` directory. Wrapping a child component with the HOC will result in a ```Warning: Failed prop type: The prop 'serverState' is marked as required in 'WithData(Apollo(Component))', but its value is 'undefined'``` error. Down-tree child components will have access to Apollo, and can be wrapped with any other sort of ```graphql()```, ```compose()```, etc HOC's.
62
+
63
+
In these _with-apollo_ examples, the `withData()` HOC must wrap a top-level component from within the `pages` directory. Wrapping a child component with the HOC will result in a `Warning: Failed prop type: The prop 'serverState' is marked as required in 'WithData(Apollo(Component))', but its value is 'undefined'` error. Down-tree child components will have access to Apollo, and can be wrapped with any other sort of `graphql()`, `compose()`, etc HOC's.
Copy file name to clipboardexpand all lines: examples/with-apollo-and-redux/README.md
+10-3
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,7 @@ now
38
38
```
39
39
40
40
## The idea behind the example
41
+
41
42
This example serves as a conduit if you were using Apollo 1.X with Redux, and are migrating to Apollo 2.x, however, you have chosen not to manage your entire application state within Apollo (`apollo-link-state`).
42
43
43
44
In 2.0.0, Apollo serves out-of-the-box support for redux in favor of Apollo's state management. This example aims to be an amalgamation of the [`with-apollo`](https://github.com/zeit/next.js/tree/master/examples/with-apollo) and [`with-redux`](https://github.com/zeit/next.js/tree/master/examples/with-redux) examples.
@@ -46,11 +47,17 @@ Note that you can access the redux store like you normally would using `react-re
In these *with-apollo* examples, the ```withData()``` HOC must wrap a top-level component from within the ```pages``` directory. Wrapping a child component with the HOC will result in a ```Warning: Failed prop type: The prop 'serverState' is marked as required in 'WithData(Apollo(Component))', but its value is 'undefined'``` error. Down-tree child components will have access to Apollo, and can be wrapped with any other sort of ```graphql()```, ```compose()```, etc HOC's.
62
+
63
+
In these _with-apollo_ examples, the `withData()` HOC must wrap a top-level component from within the `pages` directory. Wrapping a child component with the HOC will result in a `Warning: Failed prop type: The prop 'serverState' is marked as required in 'WithData(Apollo(Component))', but its value is 'undefined'` error. Down-tree child components will have access to Apollo, and can be wrapped with any other sort of `graphql()`, `compose()`, etc HOC's.
Copy file name to clipboardexpand all lines: examples/with-apollo-auth/README.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -43,13 +43,13 @@ This is an extention of the _[with Apollo](https://github.com/zeit/next.js/tree/
43
43
44
44
> [Apollo](https://www.apollographql.com/client/) is a GraphQL client that allows you to easily query the exact data you need from a GraphQL server. In addition to fetching and mutating data, Apollo analyzes your queries and their results to construct a client-side cache of your data, which is kept up to date as further queries and mutations are run, fetching more results from the server.
45
45
>
46
-
> In this simple example, we integrate Apollo seamlessly with Next by wrapping our *pages* inside a [higher-order component (HOC)](https://facebook.github.io/react/docs/higher-order-components.html). Using the HOC pattern we're able to pass down a central store of query result data created by Apollo into our React component hierarchy defined inside each page of our Next application.
46
+
> In this simple example, we integrate Apollo seamlessly with Next by wrapping our _pages_ inside a [higher-order component (HOC)](https://facebook.github.io/react/docs/higher-order-components.html). Using the HOC pattern we're able to pass down a central store of query result data created by Apollo into our React component hierarchy defined inside each page of our Next application.
47
47
>
48
-
> On initial page load, while on the server and inside `getInitialProps`, we invoke the Apollo method, [`getDataFromTree`](https://www.apollographql.com/docs/react/features/server-side-rendering.html#getDataFromTree). This method returns a promise; at the point in which the promise resolves, our Apollo Client store is completely initialized.
48
+
> On initial page load, while on the server and inside `getInitialProps`, we invoke the Apollo method, [`getDataFromTree`](https://www.apollographql.com/docs/react/features/server-side-rendering.html#getDataFromTree). This method returns a promise; at the point in which the promise resolves, our Apollo Client store is completely initialized.
49
49
>
50
50
> This example relies on [graph.cool](https://www.graph.cool) for its GraphQL backend.
51
51
>
52
-
> *Note: If you're interested in integrating the client with your existing Redux store check out the [`with-apollo-and-redux`](https://github.com/zeit/next.js/tree/master/examples/with-apollo-and-redux) example.*
52
+
> _Note: If you're interested in integrating the client with your existing Redux store check out the [`with-apollo-and-redux`](https://github.com/zeit/next.js/tree/master/examples/with-apollo-and-redux) example._
53
53
54
54
[graph.cool](https://www.graph.cool) can be setup with many different
55
55
[authentication providers](https://www.graph.cool/docs/reference/integrations/overview-seimeish6e/#authentication-providers), the most basic of which is [email-password authentication](https://www.graph.cool/docs/reference/simple-api/user-authentication-eixu9osueb/#email-and-password). Once email-password authentication is enabled for your graph.cool project, you are provided with 2 useful mutations: `createUser` and `signinUser`.
@@ -65,6 +65,6 @@ It is important to note the use of Apollo's `resetStore()` method after signing
65
65
To get this example running locally, you will need to create a graph.cool
66
66
account, and provide [the `project.graphcool` schema](https://github.com/zeit/next.js/blob/master/examples/with-apollo-auth/project.graphcool).
67
67
68
-
69
68
### Note:
70
-
In these *with-apollo* examples, the ```withData()``` HOC must wrap a top-level component from within the ```pages``` directory. Wrapping a child component with the HOC will result in a ```Warning: Failed prop type: The prop 'serverState' is marked as required in 'WithData(Apollo(Component))', but its value is 'undefined'``` error. Down-tree child components will have access to Apollo, and can be wrapped with any other sort of ```graphql()```, ```compose()```, etc HOC's.
69
+
70
+
In these _with-apollo_ examples, the `withData()` HOC must wrap a top-level component from within the `pages` directory. Wrapping a child component with the HOC will result in a `Warning: Failed prop type: The prop 'serverState' is marked as required in 'WithData(Apollo(Component))', but its value is 'undefined'` error. Down-tree child components will have access to Apollo, and can be wrapped with any other sort of `graphql()`, `compose()`, etc HOC's.
Copy file name to clipboardexpand all lines: examples/with-apollo/README.md
+3-4
Original file line number
Diff line number
Diff line change
@@ -45,12 +45,11 @@ now
45
45
46
46
[Apollo](https://www.apollographql.com/client/) is a GraphQL client that allows you to easily query the exact data you need from a GraphQL server. In addition to fetching and mutating data, Apollo analyzes your queries and their results to construct a client-side cache of your data, which is kept up to date as further queries and mutations are run, fetching more results from the server.
47
47
48
-
In this simple example, we integrate Apollo seamlessly with Next by wrapping our *pages/_app.js* inside a [higher-order component (HOC)](https://facebook.github.io/react/docs/higher-order-components.html). Using the HOC pattern we're able to pass down a central store of query result data created by Apollo into our React component hierarchy defined inside each page of our Next application.
48
+
In this simple example, we integrate Apollo seamlessly with Next by wrapping our _pages/\_app.js_ inside a [higher-order component (HOC)](https://facebook.github.io/react/docs/higher-order-components.html). Using the HOC pattern we're able to pass down a central store of query result data created by Apollo into our React component hierarchy defined inside each page of our Next application.
49
49
50
-
On initial page load, while on the server and inside `getInitialProps`, we invoke the Apollo method, [`getDataFromTree`](https://www.apollographql.com/docs/react/features/server-side-rendering.html#getDataFromTree). This method returns a promise; at the point in which the promise resolves, our Apollo Client store is completely initialized.
50
+
On initial page load, while on the server and inside `getInitialProps`, we invoke the Apollo method, [`getDataFromTree`](https://www.apollographql.com/docs/react/features/server-side-rendering.html#getDataFromTree). This method returns a promise; at the point in which the promise resolves, our Apollo Client store is completely initialized.
51
51
52
52
This example relies on [graph.cool](https://www.graph.cool) for its GraphQL backend.
53
53
54
-
55
-
Note: Do not be alarmed that you see two renders being executed. Apollo recursively traverses the React render tree looking for Apollo query components. When it has done that, it fetches all these queries and then passes the result to a cache. This cache is then used to render the data on the server side (another React render).
54
+
Note: Do not be alarmed that you see two renders being executed. Apollo recursively traverses the React render tree looking for Apollo query components. When it has done that, it fetches all these queries and then passes the result to a cache. This cache is then used to render the data on the server side (another React render).
Copy file name to clipboardexpand all lines: examples/with-docker/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ now --docker -e API_URL="https://example.com"
47
47
48
48
## The idea behind the example
49
49
50
-
This example show how to set custom environment variables for your __docker application__ at runtime.
50
+
This example show how to set custom environment variables for your **docker application** at runtime.
51
51
52
52
The `dockerfile` is the simplest way to run Next.js app in docker, and the size of output image is `173MB`. However, for an even smaller build, you can do multi-stage builds with `dockerfile.multistage`. The size of output image is `85MB`.
Copy file name to clipboardexpand all lines: examples/with-dotenv/README.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ This example shows how to inline env vars.
43
43
44
44
**Please note**:
45
45
46
-
* It is a bad practice to commit env vars to a repository. Thats why you should normally [gitignore](https://git-scm.com/docs/gitignore) your `.env` file.
47
-
* In this example, as soon as you reference an env var in your code it will be automatically be publicly available and exposed to the client.
48
-
* If you want to have more centralized control of what is exposed to the client check out the example [with-universal-configuration-build-time](../with-universal-configuration-build-time).
49
-
* Env vars are set (inlined) at build time. If you need to configure your app on rutime check out [examples/with-universal-configuration-runtime](../with-universal-configuration-runtime).
46
+
- It is a bad practice to commit env vars to a repository. Thats why you should normally [gitignore](https://git-scm.com/docs/gitignore) your `.env` file.
47
+
- In this example, as soon as you reference an env var in your code it will be automatically be publicly available and exposed to the client.
48
+
- If you want to have more centralized control of what is exposed to the client check out the example [with-universal-configuration-build-time](../with-universal-configuration-build-time).
49
+
- Env vars are set (inlined) at build time. If you need to configure your app on rutime check out [examples/with-universal-configuration-runtime](../with-universal-configuration-runtime).
0 commit comments