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

What is the react query "queryKey" typescript type

$
0
0

I'm using react query with typescript. What is the type of the arguments given to the function?

export const useUserId = (token: string) =>  useQuery<number | undefined>(['userId', token], validateToken, {    refetchOnMount: false,  });export const validateToken = async ({queryKey}: WHAT_TYPE_SHOULD_I_PUT_HERE) => {  const [_, token] = queryKey;  if (token) {    const res = await axios.get<number | undefined>(BACKEND_URL +'/', {      headers: {        Authorization: token,      },    });    return res.data;  } else {    return undefined;  }};

What type should I put where there is "WHAT_TYPE_SHOULD_I_PUT_HERE"?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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