0

I have this code working right now

module.exports.BasePrimaryNavigation = PrimaryNavigation;
module.exports.PrimaryNavigation = connect(selector, authActions)(PrimaryNavigation);

I need to add this code:

module.exports.BasePrimaryNavigation = PrimaryNavigation;
module.exports.PrimaryNavigation = connect(selector, modalActions)(PrimaryNavigation);

I've tried putting them on two lines and tried using modalActions after authActions in the first code I provided. When I put them on two lines with modalActions as the second line and authActions as the first, I get the modal to work. But when I put it first, it wont work. Meaning the authActions isn't working. What can I do to get both of these to work?

Also I've now tried this:

module.exports.BasePrimaryNavigation = PrimaryNavigation;
module.exports = {
  PrimaryNavigation: connect(selector, authActions)(PrimaryNavigation),
  SecondaryNavigation: connect(selector, modalActions)(PrimaryNavigation),
};
Rob
  • 14,746
  • 28
  • 47
  • 65
Robby
  • 183
  • 2
  • 2
  • 13

1 Answers1

0

You cannot have two exports with the same name (PrimaryNavigation). You're essentially doing this:

module.exports = {
  PrimaryNavigation: connect(selector, authActions)(PrimaryNavigation),
  PrimaryNavigation: connect(selector, modalActions)(PrimaryNavigation),
}

But you need to do something like this:

module.exports = {
  PrimaryNavigation: connect(selector, authActions)(PrimaryNavigation),
  SecondaryNavigation: connect(selector, modalActions)(PrimaryNavigation),
}

You cannot have multiple module.exports, see here

Community
  • 1
  • 1
MoeSattler
  • 6,684
  • 6
  • 24
  • 44