Skip to content

Commit d116920

Browse files
authored
Query examples: GraphQL Basic (reduxjs#1109)
* Add GraphQL example * Update gql query
1 parent 2d5b7db commit d116920

File tree

17 files changed

+17978
-4
lines changed

17 files changed

+17978
-4
lines changed

docs/rtk-query/usage/examples.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The example has some intentionally wonky behavior... when editing the name of a
5858
## React with GraphQL
5959

6060
<iframe
61-
src="https://codesandbox.io/embed/rtk-query-graphql-basic-zkqfz?fontsize=12&hidenavigation=1&theme=dark&module=%2Fsrc%2Fapi.js&runonclick=1"
61+
src="https://codesandbox.io/embed/github/reduxjs/redux-toolkit/tree/feature/v1.6-integration/examples/query/react/graphql?fontsize=12&hidenavigation=1&theme=dark&module=%2Fsrc%2Fapi.js&runonclick=1"
6262
style={{
6363
width: '100%',
6464
height: '800px',

examples/query/react/graphql/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SKIP_PREFLIGHT_CHECK=true

examples/query/react/graphql/package-lock.json

Lines changed: 17216 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"name": "graphql-example",
3+
"version": "1.0.0",
4+
"description": "",
5+
"keywords": [],
6+
"main": "./src/index.tsx",
7+
"dependencies": {
8+
"@chakra-ui/react": "1.0.0",
9+
"@emotion/react": "^11.4.0",
10+
"@emotion/styled": "^11.3.0",
11+
"@mswjs/data": "^0.3.0",
12+
"@reduxjs/toolkit": "^1.6.0-beta.0",
13+
"faker": "^5.5.3",
14+
"framer-motion": "^2.9.5",
15+
"graphql": "^15.5.0",
16+
"graphql-request": "^3.4.0",
17+
"msw": "0.28.2",
18+
"react": "17.0.2",
19+
"react-dom": "17.0.2",
20+
"react-icons": "3.11.0",
21+
"react-redux": "^7.2.4",
22+
"react-router-dom": "5.2.0",
23+
"react-scripts": "4.0.2"
24+
},
25+
"devDependencies": {
26+
"@types/faker": "^5.5.5",
27+
"@types/react": "17.0.0",
28+
"@types/react-dom": "17.0.0",
29+
"@types/react-redux": "7.1.9",
30+
"@types/react-router-dom": "5.1.6",
31+
"typescript": "4.1.3"
32+
},
33+
"resolutions": {
34+
"@typescript-eslint/parser": "4.4.1"
35+
},
36+
"scripts": {
37+
"start": "react-scripts start",
38+
"build": "react-scripts build",
39+
"prebuild": "rm -rf dist/"
40+
},
41+
"eslintConfig": {
42+
"extends": [
43+
"react-app"
44+
]
45+
},
46+
"browserslist": [
47+
">0.2%",
48+
"not dead",
49+
"not ie <= 11",
50+
"not op_mini all"
51+
],
52+
"msw": {
53+
"workerDirectory": "public"
54+
}
55+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="Web site created using create-react-app"
11+
/>
12+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13+
<!--
14+
manifest.json provides metadata used when your web app is installed on a
15+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16+
-->
17+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18+
<!--
19+
Notice the use of %PUBLIC_URL% in the tags above.
20+
It will be replaced with the URL of the `public` folder during the build.
21+
Only files inside the `public` folder can be referenced from the HTML.
22+
23+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24+
work correctly both with client-side routing and a non-root public URL.
25+
Learn how to configure a non-root public URL by running `npm run build`.
26+
-->
27+
<title>React App</title>
28+
</head>
29+
<body>
30+
<noscript>You need to enable JavaScript to run this app.</noscript>
31+
<div id="root"></div>
32+
<!--
33+
This HTML file is a template.
34+
If you open it directly in the browser, you will see an empty page.
35+
36+
You can add webfonts, meta tags, or analytics to this file.
37+
The build step will place the bundled scripts into the <body> tag.
38+
39+
To begin the development, run `npm start` or `yarn start`.
40+
To create a production bundle, use `npm run build` or `yarn build`.
41+
-->
42+
</body>
43+
</html>
44+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"short_name": "RTK Query Pagination Example",
3+
"name": "Pagination Demo",
4+
"start_url": ".",
5+
"display": "standalone",
6+
"theme_color": "#000000",
7+
"background_color": "#ffffff"
8+
}

0 commit comments

Comments
 (0)