Bhaumik Joshi
Bhaumik Joshi

Reputation: 233

Getting this error on compiling through webpack Unexpected token, expected ","

On compiling this code, I m getting this error SyntaxError: Unexpected token, expected ",". I hope you could help me with this. Error on line(13:39)

import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import thunk from 'redux-thunk';
import rootReducers from './reducers';

const initialState = {};

const middleware = [thunk];

const store = createStore({
    rootReducers,
    initialState,
    composeWithDevTools(applyMiddleware(...middleware))
});

export default store;

Thank you

Upvotes: 0

Views: 192

Answers (1)

Will Jenkins
Will Jenkins

Reputation: 9907

Your call to createStore is wrong. It should be a list of paramaters, not an object:

const store = createStore(rootReducers, initialState, composeWithDevTools(applyMiddleware(...middleware)));

The correct function signature is:

 createStore(reducer, [preloadedState], [enhancer])

see the docs here

Upvotes: 5

Related Questions