Redux-devtools-extension: t.apply is not a function

Created on 9 Oct 2017  路  5Comments  路  Source: zalmoxisus/redux-devtools-extension

Steps to reproduce

Configure my store like so, following the directions here:

import { applyMiddleware, compose, createStore } from 'redux'
import thunkMiddleware from 'redux-thunk'
...
if (window.__REDUX_DEVTOOLS_EXTENSION__) {
    middleware = [thunkMiddleware, window.__REDUX_DEVTOOLS_EXTENSION__()]
    const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
    const enhancer = composeEnhancers(applyMiddleware(...middleware))
    store = createStore(reducer, {}, enhancer)
}

Expected Behavior

Store is connected to both redux-thunk and redux devtools

Actual Behavior

Receive the error:

Uncaught (in promise) TypeError: t.apply is not a function
    at <anonymous>:3:4545
    at <anonymous>:3:985
    at <anonymous>:2:838
    at compose.js:29
    at applyMiddleware.js:41
    at <anonymous>:2:1425
    at createStore (createStore.js:51)
    at index.js:25
    at <anonymous>

Using:

  • React 16.0.0
  • Redux 3.7.2
  • Redux DevTools 2.15.1

Most helpful comment

Was able to fix this by removing window.__REDUX_DEVTOOLS_EXTENSION__() from the list of enhancers. Looks like the composeEnhancers function will perform this step for me.

All 5 comments

Was able to fix this by removing window.__REDUX_DEVTOOLS_EXTENSION__() from the list of enhancers. Looks like the composeEnhancers function will perform this step for me.

Actually I faced the same issue.
I'm using:

  • React 15.0.1
  • Redux 3.5.2
  • Redux DevTools 2.15.1

OMG, idk how you've managed to figure out the root of the issue, but you saved my day :)

same as apranovich!!! Thank you!

Same as apranovich, thanks

This caused the error:

let calculatorStore = createStore(
calculatorReducer,
0,
applyMiddleware(loggingMiddleware,window.__REDUX_DEVTOOLS_EXTENSION__())
);

How @ktraff said ,we must use compose ,because we want to apply multiple ENCHANCERS:

Solution:

let calculatorStore = createStore(
calculatorReducer,
0,
compose(applyMiddleware(loggingMiddleware),window.__REDUX_DEVTOOLS_EXTENSION__())
);

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davecarlson picture davecarlson  路  4Comments

dreszczyk picture dreszczyk  路  4Comments

codeaid picture codeaid  路  3Comments

Koleok picture Koleok  路  4Comments

michaelwalloschke picture michaelwalloschke  路  3Comments