Complete the code to import the main React library.
import [1] from 'react';
The main React library is imported using React.
Complete the code to create a functional component named App.
function [1]() { return <div>Hello World</div>; }
The main component is usually named App in React projects.
Fix the error in the import statement for a component named Header.
import [1] from './components/Header';
Component names in React must start with a capital letter, so Header is correct.
Fill both blanks to export the App component as default and import React.
[1] React from 'react'; function App() { return <div>Welcome</div>; } export [2] App;
We import React with import and export the component as default.
Fill all three blanks to create a React component that uses useState to toggle text.
import React, [1] from 'react'; function Toggle() { const [isOn, setIsOn] = [2](false); return ( <button onClick={() => setIsOn(!isOn)}> { [3] ? 'ON' : 'OFF' } </button> ); }
We import useState, call it to create state, and use the state variable isOn to show text.
