skip to Main Content

Reactjs – Generic type for react-query useQuery selector and wrong data type for non-selector hook calls

Code: export const useAllUsers = <T extends UserResponseDto>( select?: (data: UserResponseDto[]) => T ) => useQuery<UserResponseDto[], ErrorResponse, T, string[]>({ queryKey: [QueryClientKeys.GET_ALL_USERS], queryFn: async () => { const response = await ApiService.getAllUsers(); return response.data; }, select: select, staleTime: Infinity, cacheTime: Infinity,…

VIEW QUESTION

Javascript – React Router creating a Route with a path defined by an API array of objects blocked by React Query

I am using React-Query besides React-Router and I can not extract the data with React-Query in App.jsx. function App() { const { isLoading, software } = useSoftware(); return ( <QueryClientProvider client={queryClient}> <ReactQueryDevtools initialIsOpen={false} /> <BrowserRouter> <GlobalStyles /> <Routes> <Route element={<AppLayout…

VIEW QUESTION
Back To Top
Search