简体   繁体   中英

Is there a better way of exporting multiple named functions in React?

Is there a better way of writing the below lines?

const TFieldUi = withTranslation()(FieldUi);
const TDisplayFieldUi = withTranslation()(DisplayFieldUi);

export {
  TFieldUi as FieldUi,
  TDisplayFieldUi as DisplayFieldUi,
};

You can just add the keyword export in front of each variable

export const FieldUi = (props) => {}

default keyword works as well, only one per file obviously.

export default const FieldUi = (props) => {}

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