Configuring Store

Configuring Store

Providing Slice to Redux Store.

// import redux store
const configureStore = require("@reduxjs/toolkit").configureStore;
// import slice
const counterReducer = require("../features/counter/counterSlice");

// configuring store (providing the slice to our redux store)
const store = configureStore({
  reducer: {
    counter: counterReducer, // Assigning the counterReducer to the "counter" slice of the store
  },
});

// Exporting the configured store to be used in other files
module.exports = store;

Last updated

Was this helpful?