# Redux createSlice not working for me

**URL:** <https://forum.codewithmosh.com/t/redux-createslice-not-working-for-me/10880>\
**Category:** Uncategorized\
**Created:** [February 22, 2022, 5:56pm UTC](https://forum.codewithmosh.com/t/redux-createslice-not-working-for-me/10880 "2022-02-22T17:56:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobmoss14](https://avatars.discourse-cdn.com/v4/letter/b/ba9def/32.png) [@bobmoss14](https://forum.codewithmosh.com/u/bobmoss14)\
**Post date:** [February 22, 2022, 5:56pm UTC](https://forum.codewithmosh.com/t/redux-createslice-not-working-for-me/10880/1 "2022-02-22T17:56:52Z")

</div>

I used the folowing code for reduce createSlice :  
// import { createAction , createReducer} from “@reduxjs/toolkit”;  
import { createSlice} from “@reduxjs/toolkit”;  
// export const bugAdded = createAction(“bugAdded”);  
// export const bugResolved = createAction(“bugResolved”);  
// export const bugRemoved = createAction(“bugRemoved”);  
let lastId = 0;  
const slice = createSlice({  
name: “bugs”,  
initialState: [],  
reducers: {  
bugAdded: (bugs, action) =\> {  
bugs.push({

```
            id: ++lastId,
            description: action.payload.description,
            resolved: false,
        });
    },
    bugResolved: (bugs, action) => {
                const index = bugs.findIndex(bug => bug.id === action.payload.id);
                bugs[index].resolved = true;
    },
    bugRemoved: (bugs, action) => {
       bugs.filter(bug => bug.id !== action.payload.id);
       
    }
}

```

});  
and get following error what is the fix for this:  
redux-toolkit.esm.js:279

```
   Uncaught Error: "reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers
at configureStore (redux-toolkit.esm.js:279:1)
at configureStore.js:16:23
at Module../src/index.js (index.js:3:29)
at __webpack_require__ (bootstrap:19:1)
at Object.0 (configureStore.js:18:2)
at __webpack_require__ (bootstrap:19:1)
at bootstrap:83:1
at bootstrap:83:1
```

---

<div class="post-metadata">

**Author:** ![bobmoss14](https://avatars.discourse-cdn.com/v4/letter/b/ba9def/32.png) [@bobmoss14](https://forum.codewithmosh.com/u/bobmoss14)\
**Post date:** [February 22, 2022, 6:11pm UTC](https://forum.codewithmosh.com/t/redux-createslice-not-working-for-me/10880/2 "2022-02-22T18:11:55Z")

</div>

I found what was missing:  
once i added the following it worked:  
export const { bugAdded, bugResolved, bugRemoved } = slice.actions;

export default slice.reducer;
