Created
December 28, 2022 11:37
-
-
Save CodeNinja47/cbbc53866063469755e83902aa106049 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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