Reputation: 11
When I am integrating my React-Native app with Redux-Thunk I got this error:
TypeError: middleware is not a function (it is undefined)
I already tried everything on another stack overflow case but still error.
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import logger from 'redux-logger';
import app from './reducers/index';
export default function configureStore() {
const store = createStore(app, applyMiddleware(thunk, logger));
return store;
}
Upvotes: 1
Views: 2755
Reputation: 31
import thunk from "redux-thunk";
// Import redux-thunk not use this type use this type import { thunk } from "redux-thunk";
// Import redux-thunk
Upvotes: 0
Reputation: 91
This problem will be solved like this.
Problem in this line
import thunk from 'redux-thunk'
Just replace
import thunk from 'redux-thunk'
with
import {thunk} from 'redux-thunk'
Upvotes: 9
Reputation: 1263
Replace
import thunk from 'redux-thunk';
with
import {thunk} from 'redux-thunk';
Upvotes: 1