d3adb0y
01/24/2023, 3:09 PM/me/
which provides various information about the current users session. And instead of passing the userId down the component tree, it would be much easier if I could just read the userId inside my useQuery call.
export const useGetUserInfo = ({config}: UseUserInfoOptions) => {
let userId = getUserId()
return useQuery<ExtractFnReturnType<QueryFnType>>({
...config,
queryKey: ['userInfo', userId],
queryFn: () => getUserInfo(),
enabled: !!userId
});
};
I am pretty new to working with React so what I'm trying to figure out is, do I need to make this function and the components that depends on it async in order for this to work properly?rp
01/24/2023, 4:25 PMd3adb0y
01/24/2023, 5:00 PMrp
01/24/2023, 5:01 PMd3adb0y
01/24/2023, 5:02 PMrp
01/24/2023, 5:02 PMd3adb0y
01/24/2023, 5:03 PM