Warning : Assign object to a variable before exporting as module default

Viewed 11740

I'm using react-redux, and this is my root Reducer:

import Customers from "./customers/reducer";

export default {
  Customers
};

but I got this warning: Assign object to a variable before exporting as module default. How do I deal with it?

1 Answers

There are some solutions:

1- Disable the warning

import Customers from "./customers/reducer";

/* eslint import/no-anonymous-default-export: [2, {"allowObject": true}] */
export default {
    Customers
};

2- create a const then export it

import Customers from "./customers/reducer";
const aName = {
    Customers
};
export default aName;

Read this descriptions For more information.

Related