title: React-Query useQuery and axios.get with a param always return data:undefined
body: <p>I've this hook:</p>
  <pre><code>import axios from &quot;axios&quot;;
  import { useQuery } from &quot;react-query&quot;;
  
  const fetchCartPreview = (cartId, userId) =&gt; {
    console.log(&quot;Init query&quot;);
    axios
      .get(
        `${process.env.REACT_APP_API_BASE_URL}/carts/${cartId}/checkout_preview`,
        {
          headers: {
            &quot;Content-Type&quot;: &quot;application/json&quot;,
            Accept: &quot;application/json&quot;,
          },
          params: { user_id: userId },
        }
      )
      .then((response) =&gt; console.log(&quot;Response from hook&quot;, response.data));
  };
  
  export default function useCartPreview(cartId, userId) {
    return useQuery(
      [&quot;cart_preview&quot;, cartId, userId],
      async () =&gt; {
        const data = await fetchCartPreview(cartId, userId)
        return data
      },
      { onSuccess:  console.log(&quot;Finish query&quot;) }
    );
  }
  </code></pre>
  <p>The console.log(response.data) it's ok, the problem is that the useQuery, onSuccess, returns data: undefined and T don't know why..</p>
  <p><a href="https://i.stack.imgur.com/PZg2W.png" rel="nofollow noreferrer">Console.log in the component that calls the hook</a></p>
  <p>Thank you!</p>