store.js

    0

    0

    This code will export a new store with the configured reducer and middleware. It will also add a getDefaultMiddleware function to the store. This function will concatenate all the middleware specified in the friendbookApi.middleware property.

    Library: react

    import { configureStore } from "@reduxjs/toolkit";
    import { setupListeners } from "@reduxjs/toolkit/query";
    import { friendbookApi } from "./services/friendbookApi";
    
    
    
    export const store = configureStore({
      reducer: {
        [friendbookApi.reducerPath]: friendbookApi.reducer,
      },
      middleware: (getDefaultMiddleware) =>
        getDefaultMiddleware.concat(friendbookApi.middleware),
    });
    
    setupListeners(store.dispatch);
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.