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: changelog.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,7 @@
25
25
- Revamped the readme:
26
26
- Removed the badges.
27
27
- Updated the “Examples” section to reflect the [`graphql-react` examples repo](https://github.com/jaydenseric/graphql-react-examples) migration from [Node.js](https://nodejs.org), [Next.js](https://nextjs.org), and [Vercel](https://vercel.com) to [Deno](https://deno.land), [Ruck](https://ruck.tech), and [Fly.io](https://fly.io).
28
+
- Added information about Deno, import maps, TypeScript config, and [optimal JavaScript module design](https://jaydenseric.com/blog/optimal-javascript-module-design).
Copy file name to clipboardExpand all lines: readme.md
+36-11Lines changed: 36 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,20 +13,36 @@ The [exports](#exports) can also be used to custom load, cache and server side r
13
13
14
14
## Installation
15
15
16
-
First, polyfill any required globals (see [_**Requirements**_](#requirements)) that are missing in your server and client environments.
16
+
> **Note**
17
+
>
18
+
> For a [Next.js](https://nextjs.org) project, see the [`next-graphql-react`](https://npm.im/next-graphql-react) installation instructions.
17
19
18
-
### Next.js setup
20
+
For [Node.js](https://nodejs.org), to install [`graphql-react`](https://npm.im/graphql-react) and its [`react`](https://npm.im/react) peer dependency with [npm](https://npmjs.com/get-npm), run:
19
21
20
-
See the [`next-graphql-react`](https://npm.im/next-graphql-react) setup instructions.
21
-
22
-
### Custom React setup
22
+
```sh
23
+
npm install graphql-react react
24
+
```
23
25
24
-
To install with [npm](https://npmjs.com/get-npm), run:
26
+
For [Deno](https://deno.land) and browsers, an example import map (realistically use 4 import maps, with optimal URLs for server vs client and development vs production):
These dependencies might not need to be in the import map, depending on what [`graphql-react`](https://npm.im/graphql-react) modules the project imports from:
Polyfill any required globals (see [_**Requirements**_](#requirements)) that are missing in your server and client environments.
45
+
30
46
Create a single [`Cache`](#class-cache) instance and use the [`Provider`](#function-dataprovider) component to provide it for your app.
31
47
32
48
To server side render your app, use the [`waterfallRender`](https://github.com/jaydenseric/react-waterfall-render#function-waterfallrender) function from [`react-waterfall-render`](https://npm.im/react-waterfall-render).
Non [Deno](https://deno.land) projects must configure [TypeScript](https://typescriptlang.org) to use types from the ECMAScript modules that have a `// @ts-check` comment:
166
+
167
+
-[`compilerOptions.allowJs`](https://typescriptlang.org/tsconfig#allowJs) should be `true`.
168
+
-[`compilerOptions.maxNodeModuleJsDepth`](https://typescriptlang.org/tsconfig#maxNodeModuleJsDepth) should be reasonably large, e.g. `10`.
169
+
-[`compilerOptions.module`](https://typescriptlang.org/tsconfig#module) should be `"node16"` or `"nodenext"`.
170
+
146
171
## Exports
147
172
148
-
These ECMAScript modules are published to [npm](https://npmjs.com) and exported via the [`package.json`](./package.json)`exports` field:
173
+
The [npm](https://npmjs.com) package [`graphql-react`](https://npm.im/graphql-react) features [optimal JavaScript module design](https://jaydenseric.com/blog/optimal-javascript-module-design). It doesn’t have a main index module, so use deep imports from the ECMAScript modules that are exported via the [`package.json`](./package.json)field [`exports`](https://nodejs.org/api/packages.html#exports):
0 commit comments