Is this valid javascript? It does not error, and appears to work.
export {default as Chooser} from "./chooser";
My interpretation is:
importthedefaultfrom"./chooser"exportthe result from #1as Chooser
Is this what is happening?
Is this valid javascript? It does not error, and appears to work.
export {default as Chooser} from "./chooser";
My interpretation is:
import the default from "./chooser"export the result from #1 as ChooserIs this what is happening?
Your interpretation is correct.
importthedefaultfrom"./chooser"
This is correct. The default thing being exported is Chooser and on import, you must use the name given to it with as ...:
import { Chooser } from "./chooser";
exportthe result from #1 asChooser
This is also correct. The name Chooser is giving the default a new name and exporting it.
Let me break this down:
export {
default as Chooser
} from "./chooser";
What this does is specify the file from which it is exported, and default as Chooser exports the default under the name Chooser. Now, on import:
import { Chooser } from "./chooser";
You must specify Chooser to import because you've essentially named the default.
Chooser, and it must be imported as import {Chooser} from './exports';. If you want to re-export the default export, I think you need to say export {default} from './chooser;. Also, what does foo` in your answer refer to?