Kirito
Kirito

Reputation: 11

TypeError: middleware is not a function (it is undefined)

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;
}

error image emulator

Upvotes: 1

Views: 2755

Answers (3)

Harsha Gihan Liyanage
Harsha Gihan Liyanage

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

420Boys Gaming
420Boys Gaming

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

Mher
Mher

Reputation: 1263

Replace import thunk from 'redux-thunk'; with import {thunk} from 'redux-thunk';

Upvotes: 1

Related Questions