why the Provider imported module is inside of curly braces? and the React, ReactDOM are no curly braces?
- Import all exports into current module scope β
import * from "my-module.js"
- Import particular named exports β
import { func1, obj2 } from "my-module.js"
- Import the default export β
import func from "my-module.js"
- Run a moduleβs global code but not import anything β
import "my-module.js"
- Dynamic importing a module β
import("my-module.js").then((module) => { //...do something })
1 Like
React
is the default export of 'react'
.
ReactDOM
is the default export of 'react-dom'
.
Provider
is not the default export of 'react-redux'
.
1 Like
for Default Export
import person from './person.js'
or
import per from './person.js'
Imports default and only export of the imported file. We can give any name.
for Named Export
import {calSal} from './actions.js'
import {baseSal} from './actions.js'
Need to specify the export name you are importing from the file.
You can import all the named exports as a bundle from a file as follow
import * as all_actions from './actions.js'`
1 Like
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.