0

I want to export the following modules but I am unable to export.

I tried removing the default and have used const but unable to export, so I had to make another child component to export.

Here is what I tried:

export default  withStyles(styles, { withTheme: true })(app);
export default DragDropContext(HTML5Backend)(app);
1

2 Answers 2

2

You can not export more than one values as default.

In case of default exports:

  • you can export a single value
  • you can use any name when import

And for named exports

  • you can export multiple values
  • you must use the exported name when importing

So you could export one as default and one as named.

export default withStyles(styles, { withTheme: true })(app);
export const SecondComponent = DragDropContext(HTML5Backend)(app);

import DefaultComponent, {SecondComponent} from 'module';

Or you could export both as named:

export const FirstComponent = withStyles(styles, { withTheme: true })(app);
export const SecondComponent = DragDropContext(HTML5Backend)(app);

import {FirstComponent, SecondComponent} from 'module';

Read more about export and import

Sign up to request clarification or add additional context in comments.

Comments

0

You can use following:

export default withStyles(styles, { withTheme: true })(app);
export const AnotherComponent = DragDropContext(HTML5Backend)(app);

One component can be named, other can be default export

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.