Skip to content

Can useQuery be used for simple POSTs? #1107

Answered by callumbooth
banagale asked this question in General
Discussion options

You must be logged in to vote

Hi @banagale.

It looks like you're calling the fetchSessionToken not passing a callback to be invoked later. If you change the useQuery to

const { status, data, isFetching, error } = useQuery(
    exPostPath,
    () => fetchSessionToken(exPostBody)
  );

and the h2 to: <h2>{data.title}</h2> it seems to work for me. Here is a working fork too

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@banagale
Comment options

@callumbooth
Comment options

@banagale
Comment options

@banagale
Comment options

Answer selected by banagale
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants