Complete the code to export the component as default.
function Greeting() {
return <h1>Hello!</h1>;
}
export [1] Greeting;Using export default allows this component to be imported without curly braces.
Complete the code to import the default exported component.
import [1] from './Greeting'; function App() { return <[1] />; }
Default exports are imported without curly braces and can use the same name as the component.
Fix the error in importing a named export.
import [1] from './Button'; function App() { return <Button />; }
Named exports must be imported with curly braces to match the export syntax.
Fill both blanks to export and import a named component correctly.
function Header() {
return <header>Welcome</header>;
}
export [1];
import [2] from './Header';default keyword when exporting named components.Named exports use export { Header } and must be imported with curly braces.
Fill all three blanks to export multiple named components and import them correctly.
export function Footer() {
return <footer>Bye</footer>;
}
export function Sidebar() {
return <aside>Links</aside>;
}
import [1] from './Layout';
import [2] from './Layout';
function App() {
return (
<>
<[3] />
<Sidebar />
</>
);
}When importing multiple named exports, use curly braces around each name.
