// createApi.jsx
export const api = createApi({
reducerPath: 'api',
baseQuery: fetchBaseQuery({baseUrl: 'http://localhost:3000'}),
tagTypes: ['products'],
endpoints: builder => ({
getPageDataCards: builder.query({
query: () => '/cards',
providesTags: ['products'],
}),
})
export const {
useGetPageDataCardsQuery,
} = api
// configureStore.jsx
import { configureStore } from "@reduxjs/toolkit";
import reducer from "./mainSlice";
import { api } from "./createApi";
export const store = configureStore({
reducer: {
reducer,
[api.reducerPath]: api.reducer,
},
middleware: (getDefaultMiddleware) => getDefaultMiddleware()
})
// Cards.jsx
import { useGetPageDataCardsQuery } from '../../store/createApi';
export const Cards = () => {
const {
data: cards = [],
isFetching
} = useGetPageDataCardsQuery()
})
Почему ошибка (0 , store_createApi__WEBPACK_IMPORTED_MODULE_2_.useGetPageDataCards) is not a function ?
Пути все правильные, абсолютно точно