Home > Software engineering >  To get a short name for data from a react-query
To get a short name for data from a react-query

Time:07-17

here is my code

const { data , isLoading, ...} = useInfo();

console.log(data?.data.payload.info);

'useInfo' is react-query hook i made. data?.data.payload.infois is too long..

i want to use data name with no deps

Is there a way to use it as below?

console.log(info) => returns data only i need 

teach me the way and sorry for my poor English

  • Related