Skip to content

Instantly share code, notes, and snippets.

@CodeNinja47
Created December 28, 2022 11:37
Show Gist options
  • Select an option

  • Save CodeNinja47/cbbc53866063469755e83902aa106049 to your computer and use it in GitHub Desktop.

Select an option

Save CodeNinja47/cbbc53866063469755e83902aa106049 to your computer and use it in GitHub Desktop.
export default function Testing({ environment }) {
// a react useState hook
const [text, setText] = useState('');
const makeApiCall = () => {
// Make the graphQL call by passing the test environment
fetchQuery(HelloQuery, {}, environment).subscribe({
next: (data) => {
// The HelloQuery will return a string, so we can set that to
// our state object
setText(data.hello);
console.log(data.hello)
},
error: (error) => {
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment