Skip to content Skip to sidebar Skip to footer

Redux-thunk : Actions Must Be Plain Objects

Redux thunk is not working for me, not sure why not. Before, everything worked. Now I'm trying to get redux-thunk to work, but it's just giving me Actions must be plain objects

Solution 1:

You're not using your createStore method, rather importing it from redux again. So the middleware is not added.

import React, { Component } from "react";
import { Provider } from "react-redux";
import { createStore } from "redux"; <--
import reducer from "./src/reducers";

export default class App extends Component {
  constructor(props) {
    super(props);
    this.store = createStore(reducer);
  }

  render() {
    return (
      <Provider store={this.store}>
        //...My App
      </Provider>
    );
  }
}

Post a Comment for "Redux-thunk : Actions Must Be Plain Objects"