diff --git a/example/webpack-example/index.jsx b/example/webpack-example/index.jsx index da375043..6b8be004 100644 --- a/example/webpack-example/index.jsx +++ b/example/webpack-example/index.jsx @@ -3,22 +3,10 @@ import * as ReactDOMClient from 'react-dom/client'; import { Voyager } from 'graphql-voyager'; -class Test extends React.Component { - constructor() { - super(); - } - - render() { - return ( - - ); - } - - async introspectionProvider(query) { - const response = await fetch('https://swapi-graphql.netlify.app/.netlify/functions/index', { +async function introspectionProvider(query) { + const response = await fetch( + 'https://swapi-graphql.netlify.app/.netlify/functions/index', + { method: 'post', headers: { Accept: 'application/json', @@ -26,10 +14,15 @@ class Test extends React.Component { }, body: JSON.stringify({ query }), credentials: 'omit', - }); - return response.json(); - } + }, + ); + return response.json(); } const reactRoot = ReactDOMClient.createRoot(document.getElementById('voyager')); -reactRoot.render(); +reactRoot.render( + , +);