Michael Durrant
Michael Durrant

Reputation: 96454

How to combine default and named exports into one statement in JavaScript?

I have two exports:

export { round, getCompassDirection };
export default App;

How can I combine them into one call?

I tried:

export App, { round, getCompassDirection };

and

export default App, { round, getCompassDirection };

but I get syntax errors. I searched for answers but the subject is broad and I get a lot of results that don't address this specific need.

Upvotes: 5

Views: 993

Answers (1)

Michael Durrant
Michael Durrant

Reputation: 96454

Using this syntax works:

export { App as default, round, getCompassDirection };

Upvotes: 9

Related Questions