Reputation: 4951
index.js
import { Human } from 'test';
export default Human;
I am importing a named export Human
from test
. I am exporting Human as default
from index.js
to allow others to import Human from index.js
instead of test
.
Ex:
import Human from 'index';
How to combine the above 2 statements from index.js
into one line?
Upvotes: 5
Views: 2167
Reputation: 44145
Use as
:
export { Human as default } from "test";
This imports Human
, changes it to default
, and exports it.
Upvotes: 6