language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | vercel | next.js | a3495b364de9e199e468b8f0e231beefeb9e55e0.json | Fix JSX in readme (#2512)
An unclosed tag was resulting in some broken syntax highlighting. | readme.md | @@ -353,7 +353,7 @@ export default () => (
// pages/index.js
import Link from 'next/link'
export default () => (
- <div>Click <Link href='/about'><img src="/static/image.png"></Link></div>
+ <div>Click <Link href='/about'><img src="/static/image.png" /></Link></div>
)
```
@@ -1132,4 +1132,4 @@ Please see our [... | false |
Other | vercel | next.js | dc607e452b35e68f46433d92e5ead621ce049855.json | Add docs for next/error (#2513) | readme.md | @@ -777,6 +777,37 @@ export default class Error extends React.Component {
}
```
+### Reusing the build in error page
+
+If you want to render the build in error page you can by using `next/error`:
+
+```jsx
+import React from 'react'
+import Error from 'next/error'
+import fetch from 'isomorphic-fetch'
+
+export de... | false |
Other | vercel | next.js | 9cc8d26a68ecc93f338c7e9af28e555ed825e2fe.json | fix regex for pages that end with index (#2505) | lib/page-loader.js | @@ -18,7 +18,7 @@ export default class PageLoader {
if (route[0] !== '/') {
throw new Error('Route name should start with a "/"')
}
- route = route.replace(/index$/, '')
+ route = route.replace(/\/index$/, '/')
if (route === '/') return route
return route.replace(/\/$/, '') | true |
Other | vercel | next.js | 9cc8d26a68ecc93f338c7e9af28e555ed825e2fe.json | fix regex for pages that end with index (#2505) | server/build/plugins/pages-plugin.js | @@ -14,7 +14,7 @@ export default class PagesPlugin {
pages.forEach((chunk) => {
const page = compilation.assets[chunk.name]
const pageName = MATCH_ROUTE_NAME.exec(chunk.name)[1]
- let routeName = `/${pageName.replace(/[/\\]?index$/, '')}`
+ let routeName = pageName
// W... | true |
Other | vercel | next.js | 871bc4e06b4cede9060972423c06e71d0d3ade22.json | Add tests for EventEmitter. (#2515) | lib/EventEmitter.js | @@ -6,6 +6,10 @@ export default class EventEmitter {
this.listeners[event] = new Set()
}
+ if (this.listeners[event].has(cb)) {
+ throw new Error(`The listener already exising in event: ${event}`)
+ }
+
this.listeners[event].add(cb)
}
@@ -15,7 +19,6 @@ export default class EventEmitte... | true |
Other | vercel | next.js | 871bc4e06b4cede9060972423c06e71d0d3ade22.json | Add tests for EventEmitter. (#2515) | test/unit/EventEmitter.test.js | @@ -0,0 +1,82 @@
+/* global describe, it, expect */
+import EventEmitter from '../../dist/lib/EventEmitter'
+
+describe('EventEmitter', () => {
+ describe('With listeners', () => {
+ it('should listen to a event', (done) => {
+ const ev = new EventEmitter()
+ ev.on('sample', done)
+ ev.emit('sample')... | true |
Other | vercel | next.js | 2d510d640a9528e2a721eda3781f82c4a4daeb3f.json | Add hostname argument to next-dev (#2500) (#2506) | bin/next-dev | @@ -12,12 +12,12 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'development'
const argv = parseArgs(process.argv.slice(2), {
alias: {
h: 'help',
+ H: 'hostname',
p: 'port'
},
boolean: ['h'],
- default: {
- p: 3000
- }
+ string: ['H'],
+ default: { p: 3000 }
})
if (argv.help) {
@@ -... | false |
Other | vercel | next.js | fc259cf985327f4b54f27503c824f253c506639f.json | Send credentials with on-demand-entries-ping (#2509) | client/on-demand-entries-client.js | @@ -11,12 +11,16 @@ export default () => {
async function ping () {
try {
const url = `/_next/on-demand-entries-ping?page=${Router.pathname}`
- const res = await fetch(url)
+ const res = await fetch(url, {
+ credentials: 'same-origin'
+ })
const payload = await res.json()
... | false |
Other | vercel | next.js | 1c7b2603d4730dd4e6329d8dbd61447d07a7a2bb.json | Block special pages from the public. (#2479)
Otherwise, users could invoke 500 errors. | server/index.js | @@ -24,6 +24,11 @@ const internalPrefixes = [
/^\/static\//
]
+const blockedPages = {
+ '/_document': true,
+ '/_error': true
+}
+
export default class Server {
constructor ({ dir = '.', dev = false, staticMarkup = false, quiet = false, conf = null } = {}) {
this.dir = resolve(dir)
@@ -251,6 +256,10 @@... | true |
Other | vercel | next.js | 1c7b2603d4730dd4e6329d8dbd61447d07a7a2bb.json | Block special pages from the public. (#2479)
Otherwise, users could invoke 500 errors. | test/integration/production/test/index.test.js | @@ -49,6 +49,14 @@ describe('Production Usage', () => {
const res2 = await fetch(url, { headers })
expect(res2.status).toBe(304)
})
+
+ it('should block special pages', async () => {
+ const urls = ['/_document', '/_error']
+ for (const url of urls) {
+ const html = await renderVi... | true |
Other | vercel | next.js | 0c7089f8562d3f98903b2a321bbf82774af659c2.json | Remove mitt and use an internal EventEmitter (#2477)
This fixes one of the crucial bug in Next.js
The issue happens when you try to load a page when it's
prefetching.
With mitt, it only fires the first registered event. | client/index.js | @@ -1,8 +1,8 @@
import { createElement } from 'react'
import ReactDOM from 'react-dom'
-import mitt from 'mitt'
import HeadManager from './head-manager'
import { createRouter } from '../lib/router'
+import EventEmitter from '../lib/EventEmitter'
import App from '../lib/app'
import { loadGetInitialProps, getURL } ... | true |
Other | vercel | next.js | 0c7089f8562d3f98903b2a321bbf82774af659c2.json | Remove mitt and use an internal EventEmitter (#2477)
This fixes one of the crucial bug in Next.js
The issue happens when you try to load a page when it's
prefetching.
With mitt, it only fires the first registered event. | lib/EventEmitter.js | @@ -0,0 +1,21 @@
+export default class EventEmitter {
+ listeners = {}
+
+ on (event, cb) {
+ if (!this.listeners[event]) {
+ this.listeners[event] = new Set()
+ }
+
+ this.listeners[event].add(cb)
+ }
+
+ emit (event, ...data) {
+ if (!this.listeners[event]) return
+ this.listeners[event].forEa... | true |
Other | vercel | next.js | 0c7089f8562d3f98903b2a321bbf82774af659c2.json | Remove mitt and use an internal EventEmitter (#2477)
This fixes one of the crucial bug in Next.js
The issue happens when you try to load a page when it's
prefetching.
With mitt, it only fires the first registered event. | lib/page-loader.js | @@ -1,5 +1,5 @@
/* global window, document, __NEXT_DATA__ */
-import mitt from 'mitt'
+import EventEmitter from './EventEmitter'
const webpackModule = module
@@ -10,10 +10,10 @@ export default class PageLoader {
this.pageCache = {}
this.pageLoadedHandlers = {}
- this.pageRegisterEvents = mitt()
+ ... | true |
Other | vercel | next.js | 0c7089f8562d3f98903b2a321bbf82774af659c2.json | Remove mitt and use an internal EventEmitter (#2477)
This fixes one of the crucial bug in Next.js
The issue happens when you try to load a page when it's
prefetching.
With mitt, it only fires the first registered event. | lib/router/router.js | @@ -1,7 +1,7 @@
/* global __NEXT_DATA__ */
import { parse, format } from 'url'
-import mitt from 'mitt'
+import EventEmitter from '../EventEmitter'
import shallowEquals from '../shallow-equals'
import PQueue from '../p-queue'
import { loadGetInitialProps, getURL } from '../utils'
@@ -22,7 +22,7 @@ export default... | true |
Other | vercel | next.js | 0c7089f8562d3f98903b2a321bbf82774af659c2.json | Remove mitt and use an internal EventEmitter (#2477)
This fixes one of the crucial bug in Next.js
The issue happens when you try to load a page when it's
prefetching.
With mitt, it only fires the first registered event. | package.json | @@ -77,7 +77,6 @@
"loader-utils": "1.1.0",
"md5-file": "3.1.1",
"minimist": "1.2.0",
- "mitt": "1.1.2",
"mkdirp-then": "1.2.0",
"mv": "2.1.1",
"mz": "2.6.0", | true |
Other | vercel | next.js | 0c7089f8562d3f98903b2a321bbf82774af659c2.json | Remove mitt and use an internal EventEmitter (#2477)
This fixes one of the crucial bug in Next.js
The issue happens when you try to load a page when it's
prefetching.
With mitt, it only fires the first registered event. | yarn.lock | @@ -71,8 +71,8 @@ acorn@^4.0.3, acorn@^4.0.4:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787"
acorn@^5.0.0, acorn@^5.0.1:
- version "5.0.3"
- resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.0.3.tgz#c460df08491463f028ccb82eab3730bf01087b3d"
+ vers... | true |
Other | vercel | next.js | 5a840cc39e1b6f823978e3cd3a8dc8f3e7a65108.json | allow cleaning from non-cwd (#2451) | server/build/clean.js | @@ -4,5 +4,5 @@ import getConfig from '../config'
export default function clean (dir) {
const dist = getConfig(dir).distDir
- return del(resolve(dir, dist))
+ return del(resolve(dir, dist), { force: true })
} | false |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/basic-css/package.json | @@ -7,7 +7,7 @@
"start": "next start"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}, | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/custom-server-express/package.json | @@ -6,7 +6,7 @@
},
"dependencies": {
"express": "^4.14.0",
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
} | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/custom-server-hapi/package.json | @@ -6,7 +6,7 @@
},
"dependencies": {
"hapi": "^16.1.0",
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"good": "^7.1.0", | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/custom-server-koa/package.json | @@ -8,7 +8,7 @@
"dependencies": {
"koa": "^2.0.1",
"koa-router": "^7.1.0",
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
} | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/custom-server/package.json | @@ -5,7 +5,7 @@
"start": "NODE_ENV=production node server.js"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
} | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/data-fetch/package.json | @@ -8,7 +8,7 @@
},
"dependencies": {
"isomorphic-fetch": "^2.2.1",
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}, | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/parameterized-routing/package.json | @@ -5,7 +5,7 @@
"start": "NODE_ENV=production node server.js"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"path-match": "1.2.4",
"react": "^15.4.2",
"react-dom": "^15.4.2" | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/ssr-caching/package.json | @@ -7,7 +7,7 @@
"dependencies": {
"express": "^4.14.0",
"lru-cache": "^4.0.2",
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
} | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/using-inferno/package.json | @@ -11,7 +11,7 @@
"inferno-compat": "^1.4.0",
"inferno-server": "^1.4.0",
"module-alias": "^2.0.0",
- "next": "^2.0.0-beta"
+ "next": "latest"
},
"author": "",
"license": "MIT" | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/using-preact/package.json | @@ -8,7 +8,7 @@
},
"dependencies": {
"module-alias": "^2.0.0",
- "next": "^2.0.0-beta",
+ "next": "latest",
"preact": "^7.2.0",
"preact-compat": "^3.14.0"
}, | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/using-router/package.json | @@ -9,7 +9,7 @@
"start": "next start"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}, | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-amp/package.json | @@ -7,7 +7,7 @@
"start": "next start"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}, | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-aphrodite/package.json | @@ -8,7 +8,7 @@
},
"dependencies": {
"aphrodite": "^1.1.0",
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}, | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-apollo-and-redux/package.json | @@ -8,7 +8,7 @@
},
"dependencies": {
"graphql": "^0.9.1",
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-apollo": "^1.0.0-rc.2",
"redux": "^3.6.0" | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-apollo/package.json | @@ -8,7 +8,7 @@
},
"dependencies": {
"graphql": "^0.9.1",
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-apollo": "^1.0.0-rc.3"
}, | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-custom-babel-config/package.json | @@ -9,7 +9,7 @@
"start": "next start"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}, | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-cxs/package.json | @@ -8,7 +8,7 @@
},
"dependencies": {
"cxs": "^3.0.0",
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}, | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-external-scoped-css/package.json | @@ -10,7 +10,7 @@
"run": "next start"
},
"dependencies":{
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}, | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-fela/package.json | @@ -8,7 +8,7 @@
},
"dependencies": {
"fela": "^4.1.2",
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-fela": "^4.1.2" | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-flow/package.json | @@ -10,7 +10,7 @@
"start": "next start"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}, | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-glamor/package.json | @@ -8,7 +8,7 @@
},
"dependencies": {
"glamor": "^2.20.24",
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}, | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-global-stylesheet/package.json | @@ -14,7 +14,7 @@
"babel-plugin-module-resolver": "2.5.0",
"babel-plugin-wrap-in-js": "^1.1.0",
"glob": "7.1.1",
- "next": "^2.0.0-beta.18",
+ "next": "latest",
"node-sass": "^4.4.0",
"normalize.css": "5.0.0",
"postcss-easy-import": "2.0.0", | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-jest/package.json | @@ -1,7 +1,7 @@
{
"name": "with-jest",
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}, | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-loading/package.json | @@ -9,7 +9,7 @@
"start": "next start"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"nprogress": "^0.2.0",
"react": "^15.4.2",
"react-dom": "^15.4.2" | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-mobx/package.json | @@ -9,7 +9,7 @@
"dependencies": {
"mobx": "^2.7.0",
"mobx-react": "^4.0.4",
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}, | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-next-routes/package.json | @@ -5,7 +5,7 @@
"start": "NODE_ENV=production node server.js"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"next-routes": "^1.0.17",
"react": "^15.4.2",
"react-dom": "^15.4.2" | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-prefetching/package.json | @@ -7,7 +7,7 @@
"start": "next start"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}, | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-react-helmet/package.json | @@ -8,7 +8,7 @@
"start": "next start"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-helmet": "^4.0.0" | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-react-intl/package.json | @@ -11,7 +11,7 @@
"babel-plugin-react-intl": "^2.3.1",
"glob": "^7.1.1",
"intl": "^1.2.5",
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-intl": "^2.2.3" | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-react-md/package.json | @@ -7,7 +7,7 @@
"start": "next start"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-addons-css-transition-group": "^15.4.2",
"react-addons-transition-group": "^15.4.2", | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-redux/package.json | @@ -7,7 +7,7 @@
"start": "next start"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"next-redux-wrapper": "^1.0.0",
"react": "^15.4.2",
"react-dom": "^15.4.2", | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-refnux/package.json | @@ -9,7 +9,7 @@
"author": "",
"license": "ISC",
"dependencies": {
- "next": "^2.0.0-beta.31",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"refnux": "^1.3.0" | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-scoped-stylesheets-and-postcss/package.json | @@ -12,7 +12,7 @@
"dependencies": {
"babel-plugin-wrap-in-js": "^1.1.1",
"css-loader": "^0.26.1",
- "next": "^2.0.0-beta.26",
+ "next": "latest",
"postcss-cssnext": "^2.9.0",
"postcss-loader": "^1.3.0",
"raw-loader": "^0.5.1", | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-styled-components/package.json | @@ -7,7 +7,7 @@
"start": "next start"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"styled-components": "^1.4.4" | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-styled-jsx-postcss/package.json | @@ -7,7 +7,7 @@
"start": "next start"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"postcss-cssnext": "^2.9.0",
"react": "^15.4.2",
"react-dom": "^15.4.2", | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-styletron/package.json | @@ -7,7 +7,7 @@
"start": "next start"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"styletron-client": "^2.2.0", | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | examples/with-universal-configuration/package.json | @@ -7,7 +7,7 @@
"start": "next start"
},
"dependencies": {
- "next": "^2.0.0-beta",
+ "next": "latest",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}, | true |
Other | vercel | next.js | 7f0591896aacd30c8d929dcf140729b81c9fe443.json | Use latest version of Next for all examples (#1597)
* Use latest for all examples
* Update yarn.lock | yarn.lock | @@ -484,13 +484,13 @@ babel-plugin-jest-hoist@^19.0.0:
version "19.0.0"
resolved "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-19.0.0.tgz#4ae2a04ea612a6e73651f3fde52c178991304bea"
-babel-plugin-module-resolver@2.5.0:
- version "2.5.0"
- resolved "https://registry.npmjs.org/babe... | true |
Other | vercel | next.js | f9aa7bdbc19f28bbf076ec6cb361597e30c312ab.json | Fix typo in signal message on process close event (#1601) | bin/next | @@ -65,7 +65,7 @@ const startProcess = () => {
if (signal === 'SIGKILL') {
process.exit(137)
}
- console.log(`got signal ${signal}, exitting`)
+ console.log(`got signal ${signal}, exiting`)
process.exit(1)
}
process.exit(0) | false |
Other | vercel | next.js | 191d65889be4fdaedc4442ff9cf4435ee71705d9.json | Fix typo in Shallow Routing doc (#1593) | readme.md | @@ -423,7 +423,7 @@ Router.onAppUpdated = (nextUrl) => {
Shallow routing allows you to change the URL without running `getInitialProps`. You'll receive the updated `pathname` and the `query` via the `url` prop of the same page that's loaded, without losing state.
-You can do this by invoking the eith `Router.push`... | false |
Other | vercel | next.js | 9393440402f089d8371e6a8d7c66b9a42167a3cf.json | Remove babelrc from preact example doc (#1583)
The mentioned .babelrc usage is not needed for using preact with Next anymore. The actual code change was merged in (#1194) | examples/using-preact/README.md | @@ -29,5 +29,4 @@ This example uses [Preact](https://github.com/developit/preact) instead of React
Here's how we did it:
-* Create `.babelrc` file with es2015 and react presets. This allow us to get rid of the hard coded React dependency for core Next.js modules.
* Use `next.config.js` to customize our webpack co... | false |
Other | vercel | next.js | bd80b78f5d2d879c01edfc03459076fd00f18b22.json | Handle undefined assets when combining. (#1569)
It's possible for common.js to be empty in certain cases.
So, we need to handle it. | server/build/plugins/combine-assets-plugin.js | @@ -11,7 +11,10 @@ export default class CombineAssetsPlugin {
compiler.plugin('after-compile', (compilation, callback) => {
let newSource = ''
this.input.forEach((name) => {
- newSource += `${compilation.assets[name].source()}\n`
+ const asset = compilation.assets[name]
+ if (!as... | false |
Other | vercel | next.js | 7699cbe9df231298bb6bc84b9728c5381a46b8ca.json | Add/readme example stateless lifecycle (#1558)
* Using developit/unfetch as the Fetch API polyfill
* Added a stateless component with getInitialProps in the readme.
* Fixed typo | readme.md | @@ -215,6 +215,20 @@ For the initial page load, `getInitialProps` will execute on the server only. `g
_Note: `getInitialProps` can **not** be used in children components. Only in `pages`._
+You can also define the `getInitialProps` lifecycle method for stateless components:
+
+```jsx
+const Page = ({ stars }) => <... | false |
Other | vercel | next.js | 769cb49c309354429bd5161485c547fd3c7d9a40.json | Fix serviceworker call on http (#1542) | lib/router/router.js | @@ -25,6 +25,7 @@ if (typeof window !== 'undefined' && typeof navigator.serviceWorker !== 'undefin
registration.unregister()
})
})
+ .catch(() => {})
}
export default class Router { | false |
Other | vercel | next.js | 6ac6b992b05f18d757b74f6f79484f3f9d75a967.json | Revive truncated text in readme (#1538) | readme.md | @@ -540,7 +540,7 @@ app.prepare().then(() => {
```
The `next` API is as follows:
-- `next(path: string, opts: object)` - `path` is
+- `next(path: string, opts: object)` - `path` is where the Next project is located
- `next(opts: object)`
Supported options: | false |
Other | vercel | next.js | e9d0aeb2b27b8a594673184c0323afe4c09b428d.json | remove extra semicolon. (#1520) | examples/with-external-scoped-css/package.json | @@ -16,6 +16,6 @@
},
"devDependencies": {
"babel-plugin-css-modules-transform": "^1.2.1",
- "node-sass": "^4.5.0",
+ "node-sass": "^4.5.0"
}
} | false |
Other | vercel | next.js | 296478b1cc34a70fa33597d7ccf85a6ab6c22a40.json | Remove master vs README warnning | readme.md | @@ -6,8 +6,6 @@
Next.js is a minimalistic framework for server-rendered React applications.
-_**NOTE! the README on the `master` branch might not match that of the [latest stable release](https://github.com/zeit/next.js/releases/latest)!**_
-
<!-- START doctoc generated TOC please keep comment here to allow auto ... | false |
Other | vercel | next.js | 32af8294a7c2b3a39c8b04c6d751fb8a46875077.json | Load the main JS bundle in production with async (#1485)
* Use a webpack plugin to combine assets.
* Add comments and make this releseable.
* Fix some typos.
* Fix some typos. | package.json | @@ -67,6 +67,7 @@
"is-windows-bash": "1.0.3",
"json-loader": "0.5.4",
"loader-utils": "1.1.0",
+ "md5-file": "3.1.1",
"minimist": "1.2.0",
"mitt": "1.1.0",
"mkdirp-then": "1.2.0", | true |
Other | vercel | next.js | 32af8294a7c2b3a39c8b04c6d751fb8a46875077.json | Load the main JS bundle in production with async (#1485)
* Use a webpack plugin to combine assets.
* Add comments and make this releseable.
* Fix some typos.
* Fix some typos. | server/build/index.js | @@ -5,14 +5,15 @@ import uuid from 'uuid'
import del from 'del'
import webpack from './webpack'
import replaceCurrentBuild from './replace'
+import md5File from 'md5-file/promise'
export default async function build (dir) {
const buildDir = join(tmpdir(), uuid.v4())
const compiler = await webpack(dir, { bui... | true |
Other | vercel | next.js | 32af8294a7c2b3a39c8b04c6d751fb8a46875077.json | Load the main JS bundle in production with async (#1485)
* Use a webpack plugin to combine assets.
* Add comments and make this releseable.
* Fix some typos.
* Fix some typos. | server/build/plugins/combine-assets-plugin.js | @@ -0,0 +1,26 @@
+// This plugin combines a set of assets into a single asset
+// This should be only used with text assets,
+// otherwise the result is unpredictable.
+export default class CombineAssetsPlugin {
+ constructor ({ input, output }) {
+ this.input = input
+ this.output = output
+ }
+
+ apply (comp... | true |
Other | vercel | next.js | 32af8294a7c2b3a39c8b04c6d751fb8a46875077.json | Load the main JS bundle in production with async (#1485)
* Use a webpack plugin to combine assets.
* Add comments and make this releseable.
* Fix some typos.
* Fix some typos. | server/build/webpack.js | @@ -7,6 +7,7 @@ import FriendlyErrorsWebpackPlugin from 'friendly-errors-webpack-plugin'
import CaseSensitivePathPlugin from 'case-sensitive-paths-webpack-plugin'
import UnlinkFilePlugin from './plugins/unlink-file-plugin'
import JsonPagesPlugin from './plugins/json-pages-plugin'
+import CombineAssetsPlugin from './... | true |
Other | vercel | next.js | 32af8294a7c2b3a39c8b04c6d751fb8a46875077.json | Load the main JS bundle in production with async (#1485)
* Use a webpack plugin to combine assets.
* Add comments and make this releseable.
* Fix some typos.
* Fix some typos. | server/document.js | @@ -59,25 +59,44 @@ export class NextScript extends Component {
_documentProps: PropTypes.any
}
- getChunkScript (filename) {
+ getChunkScript (filename, additionalProps = {}) {
const { __NEXT_DATA__ } = this.context._documentProps
let { buildStats } = __NEXT_DATA__
const hash = buildStats ? ... | true |
Other | vercel | next.js | 32af8294a7c2b3a39c8b04c6d751fb8a46875077.json | Load the main JS bundle in production with async (#1485)
* Use a webpack plugin to combine assets.
* Add comments and make this releseable.
* Fix some typos.
* Fix some typos. | server/index.js | @@ -102,6 +102,12 @@ export default class Server {
await this.serveStatic(req, res, p)
},
+ '/_next/:hash/app.js': async (req, res, params) => {
+ this.handleBuildHash('app.js', params.hash, res)
+ const p = join(this.dir, '.next/app.js')
+ await this.serveStatic(req, res, p)... | true |
Other | vercel | next.js | 32af8294a7c2b3a39c8b04c6d751fb8a46875077.json | Load the main JS bundle in production with async (#1485)
* Use a webpack plugin to combine assets.
* Add comments and make this releseable.
* Fix some typos.
* Fix some typos. | yarn.lock | @@ -455,13 +455,13 @@ babel-plugin-check-es2015-constants@^6.22.0:
dependencies:
babel-runtime "^6.22.0"
-babel-plugin-istanbul@4.0.0, babel-plugin-istanbul@^4.0.0:
- version "4.0.0"
- resolved "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-4.0.0.tgz#36bde8fbef4837e5ff0366531a2bea... | true |
Other | vercel | next.js | bc2d5f3bdb50aba7a68a35eb51655d96d43d1a08.json | Show errored file always in the error overlay. (#1470)
This was not happening when there's module not found errors.
Now we try to do this for all the errors if possible. | lib/error-debug.js | @@ -10,16 +10,16 @@ export default ({ error, error: { name, message, module } }) => (
{module ? <div style={styles.heading}>Error in {module.rawRequest}</div> : null}
{
name === 'ModuleBuildError'
- ? <pre style={styles.message} dangerouslySetInnerHTML={{ __html: ansiHTML(encodeHtml(message)) }} /... | true |
Other | vercel | next.js | bc2d5f3bdb50aba7a68a35eb51655d96d43d1a08.json | Show errored file always in the error overlay. (#1470)
This was not happening when there's module not found errors.
Now we try to do this for all the errors if possible. | server/render.js | @@ -142,9 +142,9 @@ function errorToJSON (err) {
const { name, message, stack } = err
const json = { name, message, stack }
- if (name === 'ModuleBuildError') {
- // webpack compilation error
- const { module: { rawRequest } } = err
+ if (err.module) {
+ // rawRequest contains the filename of the mod... | true |
Other | vercel | next.js | 13ccf784986107a339218b3d43a7e4ce3bdfd919.json | Fix typo in README (#1427)
`routing`not `routig` | readme.md | @@ -409,7 +409,7 @@ Router.onAppUpdated = (nextUrl) => {
</ul>
</details></p>
-Shallow routig allows you to change the URL without running `getInitialProps`. You'll receive the updated `pathname` and the `query` via the `url` prop of the same page that's loaded, without losing state.
+Shallow routing allows you t... | false |
Other | vercel | next.js | d16fb63c1bd70320a7670306e69319028098e1cf.json | Improve Redux Toolkit example (#12858) | examples/with-redux-toolkit/README.md | @@ -1,8 +1,8 @@
# Redux Toolkit example
-This example shows how to integrate Redux with Toolkit in Next.js.
+This example shows how to integrate Next.js with [Redux Toolkit](https://redux-toolkit.js.org).
-Redux toolkit makes it easier to configure a redux store, create reducers or dispatch actions, along with som... | true |
Other | vercel | next.js | d16fb63c1bd70320a7670306e69319028098e1cf.json | Improve Redux Toolkit example (#12858) | examples/with-redux-toolkit/components/add-note.js | @@ -0,0 +1,38 @@
+import { useDispatch, useSelector } from 'react-redux'
+
+import { addNote, selectNotes } from '../lib/slices/notesSlice'
+import useForm from '../lib/useForm'
+
+const AddNoteForm = () => {
+ const dispatch = useDispatch()
+ const { error } = useSelector(selectNotes)
+ const handleSubmit = useForm... | true |
Other | vercel | next.js | d16fb63c1bd70320a7670306e69319028098e1cf.json | Improve Redux Toolkit example (#12858) | examples/with-redux-toolkit/components/clock.js | @@ -1,21 +1,15 @@
-import { useSelector, shallowEqual } from 'react-redux'
+import { useSelector } from 'react-redux'
-const useClock = () => {
- return useSelector((state) => {
- return {
- lastUpdate: state.lastUpdate,
- light: state.light,
- }
- }, shallowEqual)
-}
+import { selectClock } from '.... | true |
Other | vercel | next.js | d16fb63c1bd70320a7670306e69319028098e1cf.json | Improve Redux Toolkit example (#12858) | examples/with-redux-toolkit/components/counter.js | @@ -1,27 +1,154 @@
-import { createAction } from '@reduxjs/toolkit'
-import { useSelector, useDispatch } from 'react-redux'
+import { useState } from 'react'
+import { useDispatch, useSelector } from 'react-redux'
-const useCounter = () => {
- const count = useSelector((state) => state.count)
+import {
+ decrement,... | true |
Other | vercel | next.js | d16fb63c1bd70320a7670306e69319028098e1cf.json | Improve Redux Toolkit example (#12858) | examples/with-redux-toolkit/components/edit-note.js | @@ -0,0 +1,54 @@
+import { useLayoutEffect, useRef } from 'react'
+import { useDispatch } from 'react-redux'
+
+import { editNote } from '../lib/slices/notesSlice'
+import useForm from '../lib/useForm'
+
+const EditNoteForm = ({ note = {} }) => {
+ const dialogRef = useRef()
+ const dispatch = useDispatch()
+ const ... | true |
Other | vercel | next.js | d16fb63c1bd70320a7670306e69319028098e1cf.json | Improve Redux Toolkit example (#12858) | examples/with-redux-toolkit/lib/slices/clockSlice.js | @@ -0,0 +1,21 @@
+import { createSlice } from '@reduxjs/toolkit'
+
+const clockSlice = createSlice({
+ name: 'clock',
+ initialState: {
+ lastUpdate: 0,
+ light: true,
+ },
+ reducers: {
+ tick: (state, action) => {
+ state.lastUpdate = action.payload.lastUpdate
+ state.light = !!action.payload.l... | true |
Other | vercel | next.js | d16fb63c1bd70320a7670306e69319028098e1cf.json | Improve Redux Toolkit example (#12858) | examples/with-redux-toolkit/lib/slices/counterSlice.js | @@ -0,0 +1,53 @@
+import { createSlice } from '@reduxjs/toolkit'
+
+const counterSlice = createSlice({
+ name: 'counter',
+ initialState: {
+ value: 0,
+ },
+ reducers: {
+ // Redux Toolkit allows us to write "mutating" logic in reducers. It
+ // doesn't actually mutate the state because it uses the Immer ... | true |
Other | vercel | next.js | d16fb63c1bd70320a7670306e69319028098e1cf.json | Improve Redux Toolkit example (#12858) | examples/with-redux-toolkit/lib/slices/notesSlice.js | @@ -0,0 +1,148 @@
+import { createAsyncThunk, createSelector, createSlice } from '@reduxjs/toolkit'
+
+export const addNote = createAsyncThunk(
+ 'notes/addNote',
+ async (newNote, thunkAPI) => {
+ try {
+ const response = await fetch('/api/notes', {
+ method: 'POST',
+ body: JSON.stringify(newN... | true |
Other | vercel | next.js | d16fb63c1bd70320a7670306e69319028098e1cf.json | Improve Redux Toolkit example (#12858) | examples/with-redux-toolkit/lib/useForm.js | @@ -0,0 +1,18 @@
+const useForm = (defaultValues = {}) => (handler) => async (event) => {
+ event.preventDefault()
+ event.persist()
+ const form = event.target
+ const data = Array.from(form.elements)
+ .filter((element) => element.hasAttribute('name'))
+ .reduce(
+ (object, element) => ({
+ ...o... | true |
Other | vercel | next.js | d16fb63c1bd70320a7670306e69319028098e1cf.json | Improve Redux Toolkit example (#12858) | examples/with-redux-toolkit/package.json | @@ -1,19 +1,18 @@
{
- "name": "with-redux",
+ "name": "with-redux-toolkit",
"version": "1.0.0",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
- "@reduxjs/toolkit": "^1.2.5",
+ "@nano-sql/core": "^2.3.7",
+ "@reduxjs/toolkit": "^1.3.6... | true |
Other | vercel | next.js | d16fb63c1bd70320a7670306e69319028098e1cf.json | Improve Redux Toolkit example (#12858) | examples/with-redux-toolkit/pages/_app.js | @@ -1,5 +1,6 @@
import { Provider } from 'react-redux'
-import { store } from '../store'
+
+import store from '../store'
const MyApp = ({ Component, pageProps }) => {
return ( | true |
Other | vercel | next.js | d16fb63c1bd70320a7670306e69319028098e1cf.json | Improve Redux Toolkit example (#12858) | examples/with-redux-toolkit/pages/api/notes.js | @@ -0,0 +1,112 @@
+import { nSQL } from '@nano-sql/core'
+
+const connectMiddleware = (handler) => async (req, res) => {
+ const dbName = 'with-redux-toolkit'
+
+ if (!nSQL().listDatabases().includes(dbName)) {
+ await nSQL().createDatabase({
+ id: dbName,
+ mode: 'PERM',
+ tables: [
+ {
+ ... | true |
Other | vercel | next.js | d16fb63c1bd70320a7670306e69319028098e1cf.json | Improve Redux Toolkit example (#12858) | examples/with-redux-toolkit/pages/index.js | @@ -1,25 +1,17 @@
-import { createAction } from '@reduxjs/toolkit'
-import { connect } from 'react-redux'
-import useInterval from '../lib/useInterval'
+import { useDispatch } from 'react-redux'
+
import Clock from '../components/clock'
import Counter from '../components/counter'
+import { tick } from '../lib/slices/... | true |
Other | vercel | next.js | d16fb63c1bd70320a7670306e69319028098e1cf.json | Improve Redux Toolkit example (#12858) | examples/with-redux-toolkit/pages/notes.js | @@ -0,0 +1,57 @@
+import Dynamic from 'next/dynamic'
+import Head from 'next/head'
+import { useEffect, useState } from 'react'
+import { useDispatch, useSelector } from 'react-redux'
+
+import AddNoteForm from '../components/add-note'
+import { deleteNote, loadNotes, selectNotes } from '../lib/slices/notesSlice'
+
+co... | true |
Other | vercel | next.js | d16fb63c1bd70320a7670306e69319028098e1cf.json | Improve Redux Toolkit example (#12858) | examples/with-redux-toolkit/store.js | @@ -1,26 +1,14 @@
-import { configureStore, createReducer } from '@reduxjs/toolkit'
+import { configureStore } from '@reduxjs/toolkit'
-const initialState = {
- light: false,
- lastUpdate: 0,
- count: 0,
-}
+import clockReducer from './lib/slices/clockSlice'
+import counterReducer from './lib/slices/counterSlice'
... | true |
Other | vercel | next.js | dbad9db68c49f32603b42b2a0f1851abe454cfbf.json | Update Examples for Fast Refresh (#13068) | .eslintrc.json | @@ -1,7 +1,7 @@
{
"root": true,
"parser": "babel-eslint",
- "plugins": ["react", "react-hooks", "jest"],
+ "plugins": ["react", "react-hooks", "jest", "import"],
"env": {
"browser": true,
"commonjs": true,
@@ -91,6 +91,26 @@
"packages/create-next-app/templates/**/*"
],
"rule... | true |
Other | vercel | next.js | dbad9db68c49f32603b42b2a0f1851abe454cfbf.json | Update Examples for Fast Refresh (#13068) | examples/amp-story/pages/index.js | @@ -2,122 +2,124 @@ import Head from 'next/head'
export const config = { amp: true }
-export default () => (
- <>
- <Head>
- <title>Example AMP Story in Next.js</title>
- <script
- async
- key="amp-story"
- custom-element="amp-story"
- src="https://cdn.ampproject.org/v0/am... | true |
Other | vercel | next.js | dbad9db68c49f32603b42b2a0f1851abe454cfbf.json | Update Examples for Fast Refresh (#13068) | examples/analyze-bundles/pages/about.js | @@ -1 +1,3 @@
-export default () => <div>About us</div>
+export default function About() {
+ return <div>About us</div>
+} | true |
Other | vercel | next.js | dbad9db68c49f32603b42b2a0f1851abe454cfbf.json | Update Examples for Fast Refresh (#13068) | examples/analyze-bundles/pages/contact.js | @@ -1 +1,3 @@
-export default () => <div>This is the contact page.</div>
+export default function Contact() {
+ return <div>This is the contact page.</div>
+} | true |
Other | vercel | next.js | dbad9db68c49f32603b42b2a0f1851abe454cfbf.json | Update Examples for Fast Refresh (#13068) | examples/api-routes-apollo-server-and-client-auth/pages/about.js | @@ -1,11 +1,13 @@
import Link from 'next/link'
-export default () => (
- <div>
- This is a static page goto{' '}
- <Link href="/">
- <a>dynamic</a>
- </Link>{' '}
- page.
- </div>
-)
+export default function About() {
+ return (
+ <div>
+ This is a static page goto{' '}
+ <Link href=... | true |
Other | vercel | next.js | dbad9db68c49f32603b42b2a0f1851abe454cfbf.json | Update Examples for Fast Refresh (#13068) | examples/api-routes-apollo-server-and-client/pages/about.js | @@ -1,11 +1,13 @@
import Link from 'next/link'
-export default () => (
- <div>
- This is a static page goto{' '}
- <Link href="/">
- <a>dynamic</a>
- </Link>{' '}
- page.
- </div>
-)
+export default function About() {
+ return (
+ <div>
+ This is a static page goto{' '}
+ <Link href=... | true |
Other | vercel | next.js | dbad9db68c49f32603b42b2a0f1851abe454cfbf.json | Update Examples for Fast Refresh (#13068) | examples/api-routes-rest/pages/api/user/[id].js | @@ -1,4 +1,4 @@
-export default (req, res) => {
+export default function userHandler(req, res) {
const {
query: { id, name },
method, | true |
Other | vercel | next.js | dbad9db68c49f32603b42b2a0f1851abe454cfbf.json | Update Examples for Fast Refresh (#13068) | examples/api-routes-rest/pages/api/users.js | @@ -1,7 +1,7 @@
// Fake users data
const users = [{ id: 1 }, { id: 2 }, { id: 3 }]
-export default (req, res) => {
+export default function handler(req, res) {
// Get data from your database
res.status(200).json(users)
} | true |
Other | vercel | next.js | dbad9db68c49f32603b42b2a0f1851abe454cfbf.json | Update Examples for Fast Refresh (#13068) | examples/api-routes/components/Person.js | @@ -1,9 +1,11 @@
import Link from 'next/link'
-export default ({ person }) => (
- <li>
- <Link href="/person/[id]" as={`/person/${person.id}`}>
- <a>{person.name}</a>
- </Link>
- </li>
-)
+export default function Person({ person }) {
+ return (
+ <li>
+ <Link href="/person/[id]" as={`/person/${... | true |
Other | vercel | next.js | dbad9db68c49f32603b42b2a0f1851abe454cfbf.json | Update Examples for Fast Refresh (#13068) | examples/api-routes/pages/api/people/[id].js | @@ -1,6 +1,6 @@
import { people } from '../../../data'
-export default ({ query: { id } }, res) => {
+export default function personHandler({ query: { id } }, res) {
const filtered = people.filter((p) => p.id === id)
// User with id exists | true |
Other | vercel | next.js | dbad9db68c49f32603b42b2a0f1851abe454cfbf.json | Update Examples for Fast Refresh (#13068) | examples/api-routes/pages/api/people/index.js | @@ -1,5 +1,5 @@
import { people } from '../../../data'
-export default (req, res) => {
+export default function handler(req, res) {
res.status(200).json(people)
} | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.