Unverified Commit 5032dd92 authored by Michael McQuade's avatar Michael McQuade Committed by GitHub

Change zeit fetch to vercel fetch (#21913)

This PR does the following:

- Update documentation referencing @zeit/fetch to @vercel/fetch
- Switch packages @zeit/fetch to @vercel/fetch
- ~~Fix `browser.js` to actually use @vercel/fetch, it was only using unfetch directly before~~
- Update React to 17 
- Change folder name and package name
parent 4335237a
# @zeit/fetch example # @vercel/fetch example
This example shows how to use [`@zeit/fetch`](https://npmjs.com/package/@zeit/fetch) in a Next.js application. This example shows how to use [`@vercel/fetch`](https://www.npmjs.com/package/@vercel/fetch) in a Next.js application.
## Deploy your own ## Deploy your own
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example): Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-zeit-fetch&project-name=with-zeit-fetch&repository-name=with-zeit-fetch) [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-vercel-fetch&project-name=with-vercel-fetch&repository-name=with-vercel-fetch)
## How to use ## How to use
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example: Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
```bash ```bash
npx create-next-app --example with-zeit-fetch with-zeit-fetch-app npx create-next-app --example with-vercel-fetch with-vercel-fetch-app
# or # or
yarn create next-app --example with-zeit-fetch with-zeit-fetch-app yarn create next-app --example with-vercel-fetch with-vercel-fetch-app
``` ```
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
import createFetch from '@vercel/fetch'
// since we aren't providing createFetch a fetcher it will use node-fetch as the fetcher
export default createFetch()
{ {
"name": "with-zeit-fetch", "name": "with-vercel-fetch",
"version": "1.0.0", "version": "1.0.0",
"scripts": { "scripts": {
"dev": "next", "dev": "next",
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
"start": "next start" "start": "next start"
}, },
"dependencies": { "dependencies": {
"@zeit/fetch": "5.1.1", "@vercel/fetch": "6.1.0",
"next": "latest", "next": "latest",
"node-fetch": "2.6.1", "node-fetch": "2.6.1",
"react": "^16.8.4", "react": "17.0.1",
"react-dom": "^16.8.4", "react-dom": "17.0.1",
"unfetch": "4.1.0" "unfetch": "4.2.0"
}, },
"license": "MIT" "license": "MIT"
} }
import zeitFetch from '@zeit/fetch'
export default zeitFetch()
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