简体   繁体   中英

How to default export a named import in one line?

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?

Use as :

export { Human as default } from "test";

This imports Human , changes it to default , and exports it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM