Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6212

print the query - graphql printer

$
0
0

Is there any way I can see an exact query that runs in my app and print it on the log?

For example, I am running this query:

const handleSubmit = React.useCallback(() => {    loadUsers({      variables: {        where: { firstName: (name.split(""))[0], AND: [{lastName:(name.split(""))[0]}]},      },    });    console.log(print(loadUsers));  }, [loadUsers, name]);

and I want to print and see what are the exact firstName and ```lastName`` parameters being passed into it. I read about this:

import { print } from 'graphql/language/printer';

and tried to use it like this:

console.log(print(loadUsers));

at the end of my handleSubmit but when I click on the button to run the query, I get an error saying that

Invalid AST Node.

How can I print and check my exact query? Could be any other way too - doesn't have to be with graphql printer necessarily.


Viewing all articles
Browse latest Browse all 6212

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>