-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
From the documentation, it is not clear how I can access data the which was fetched from the RTK query.
I have a like below
export const apiSlice= createApi({
reducerPath: 'api',
baseQuery: fetchBaseQuery({
baseUrl: 'url'
}),
endpoints: (builder) => ({
fetchData: builder.query({
query: () => ({
url: `/api/`,
method: 'GET',
})
})
})
});
export const { useFetchDataQuery} = apiSlice;
Now this API slice fetch the data and show the different states like isLoading, isFeteching when I use it like this in some component
const { data, isLoading, isFetching } = useFetchDataQuery();
What I really want to ask is, How can I access the same data (which is fetched in the above query) using selectors in any other component, rather than passing the data as props?
Since the data is getting stored in redux only. I was hoping to access it in a simple way like using useSelectors
Also, do we have anything like useIsFetching() like there is in react-query?
Metadata
Metadata
Assignees
Labels
No labels