A
A
Andrey_02019-12-03 18:32:37
React
Andrey_0, 2019-12-03 18:32:37

Difference between export {name}, export default {name}?

Good day.
Write the difference between a named export and a default one.
I know there can only be one export default per file. Is there any other difference between them?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
camelCaseVlad, 2019-12-03
@Andrey_0

https://developer.mozilla.org/en/docs/Web/JavaScript...
The named form is more useful for exporting multiple values. During import, it will be possible to use the same name to refer to the corresponding exported value.
Regarding the default export (default), it can be only one for each individual module (file). The default export can be a function, a class, an object, or something else. This value should be considered the "master" value, as it will be the easiest to import.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question