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

1 Answer 1

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

1
  • Just use one module.exports, not multiple. And please provide an example how you import.
    – MoeSattler
    Dec 7, 2016 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.