Ly Maneug Ly Maneug - 2 months ago 9
Javascript Question

React: What does following mean: import register, * as fromRegister from './registerReducer'?

What does the following mean:

import register, * as fromRegister from './registerReducer'?


What does register and * as fromRegister represent?

Answer

It imports register because it's default export, and then imports all contents with * as fromRegister. Let me break it down:

import register, * as fromRegister from './registerReducer'

It imports the export register which is exported by default, into the current scope, with export default ... and then imports all contents with * as fromRegister, which is a label, from the file registerReducer.js. You can read more at Mozilla Developer Network.

Comments