Skip to content

Commit c02caf2

Browse files
authored
update create react app example to test #3552 issue (#3701)
* update create react app example * Update App.jsx
1 parent c43c0c8 commit c02caf2

File tree

8 files changed

+12
-107
lines changed

8 files changed

+12
-107
lines changed

examples/graphiql-create-react-app/CHANGELOG.md

-68
This file was deleted.

examples/graphiql-create-react-app/package.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"version": "0.0.0",
44
"private": true,
55
"dependencies": {
6-
"graphiql": "^2.2.0",
7-
"graphql": "^16.8.1",
8-
"react": "^18.2.0",
9-
"react-dom": "^18.2.0",
6+
"graphiql": "^3.4.0",
7+
"graphql": "^16.9.0",
8+
"react": "^18.3.1",
9+
"react-dom": "^18.3.1",
1010
"react-scripts": "5.0.1"
1111
},
1212
"scripts": {
@@ -26,7 +26,6 @@
2626
]
2727
},
2828
"devDependencies": {
29-
"eslint-config-react-app": "^5.2.1",
30-
"worker-loader": "^2.0.0"
29+
"eslint-config-react-app": "^7.0.1"
3130
}
3231
}

examples/graphiql-create-react-app/public/index.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
name="viewport"
77
content="width=device-width, initial-scale=1, shrink-to-fit=no"
88
/>
9-
<meta name="theme-color" content="#000000" />
9+
<meta name="theme-color" content="#000" />
1010
<meta
1111
name="description"
1212
content="GraphiQL example created using create-react-app"
1313
/>
14-
1514
<title>GraphiQL create-react-app Example</title>
1615
</head>
1716
<body>

examples/graphiql-create-react-app/src/App.tsx renamed to examples/graphiql-create-react-app/src/App.jsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import React from 'react';
21
import { GraphiQL } from 'graphiql';
3-
import type { Fetcher } from '@graphiql/toolkit';
4-
import 'graphiql/graphiql.min.css';
2+
import 'graphiql/graphiql.css';
53

6-
const fetcher: Fetcher = async graphQLParams => {
7-
const data = await fetch(
4+
const fetcher = async graphQLParams => {
5+
const response = await fetch(
86
'https://swapi-graphql.netlify.app/.netlify/functions/index',
97
{
108
method: 'POST',
@@ -16,7 +14,7 @@ const fetcher: Fetcher = async graphQLParams => {
1614
credentials: 'same-origin',
1715
},
1816
);
19-
return data.json().catch(() => data.text());
17+
return response.json();
2018
};
2119

2220
const App = () => <GraphiQL fetcher={fetcher} />;
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
body {
2-
padding: 0;
32
margin: 0;
4-
min-height: 100vh;
53
}
64
#root {
7-
height: 100vh;
5+
height: 100dvh;
86
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import React from 'react';
21
import { createRoot } from 'react-dom/client';
32
import App from './App';
43
import './index.css';
54

6-
const root = createRoot(document.getElementById('root')!);
5+
const root = createRoot(document.getElementById('root'));
76
root.render(<App />);

examples/graphiql-create-react-app/src/react-app-env.d.ts

-1
This file was deleted.

examples/graphiql-create-react-app/tsconfig.json

-19
This file was deleted.

0 commit comments

Comments
 (0)