Complete the code to create a simple loading component that shows a message.
export default function Loading() {
return <div>[1]</div>;
}The loading component should display the message "Loading..." inside a div.
Complete the code to import React and define the loading component properly.
import [1] from 'react'; export default function Loading() { return <div>Loading...</div>; }
Importing React is standard to use JSX syntax in Next.js components.
Fix the error in the loading component to return a valid React element.
export default function Loading() {
return [1];
}The component must return a JSX element, like <div>Loading...</div>.
Fill both blanks to create a loading component that uses a spinner and a message.
export default function Loading() {
return (
<div className=[1] aria-live="polite">
<span className=[2]></span>
Loading...
</div>
);
}The outer div uses a container class, and the span uses a spinner class for styling the spinner.
Fill all three blanks to create a loading.tsx with a functional spinner using Tailwind CSS classes.
export default function Loading() {
return (
<div className=[1] role="status" aria-live="polite">
<svg className=[2] viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle className=[3] cx="50" cy="50" r="45" stroke="#e5e7eb" strokeWidth="10" />
</svg>
<span className="sr-only">Loading...</span>
</div>
);
}The outer div centers the spinner, the svg spins with animation, and the circle has reduced opacity for the spinner effect.