Javascript react – using createSlice and encountering 'property assignment expected' / 'Declaration or statement expected'

I’m trying for the first time to create a slice using react, and am encountering the following issue. My ‘createSlice’ looks as follows:

const querySlice = createSlice({
  name: 'querySlice',
  reducers: {
    setOutputTable: (state, action: PayloadAction<string>) => {
      state.outputTable = action.payload;      
    setInputTable: (state, action: PayloadAction<string>) => {
      state.inputTable = action.payload;      
    setSelectColumns: (state, action: PayloadAction<string>) => {
      state.selectColumns = action.payload;      
    reset() {
      return initialState;

Using VS Code, the bottom parentheses and curly bracket are marked for error, with the issues being 1) Property assignment expected. 2) Declaration or statement expected.

Does anyone recognize what might be amiss in my code? Thanks for any suggestions.

>Solution :

In your last line, it should be }), not )}

Leave a Reply