react import curly braces code example

Example: react import brackets

// When importing use no brackets for the corresponding default
// export, but include brackets for the corresponding named exports.
// A module can only have one default export, but several named exports.
// X.js
export const myX = 10 // named export
export const Hey = 20 // named export
export default 30 // default export
// Y.js
import { myX } from './X' // named import, name 'myX' must match X.js
import { Hey as whatever } from './X' // named import, changing the name
import wow from './X' // default import, name 'wow' could be anything
import * as whatever // named import of object with all named exports in X.js