Complete the code to define an ErrorBoundary component that catches errors.
export function ErrorBoundary() {
return <div>[1]</div>;
}The ErrorBoundary component should render a fallback UI like a message when an error occurs.
Complete the code to receive the error object as a prop in ErrorBoundary.
export function ErrorBoundary({ error }) {
return <div>Error: [1]</div>;
}Displaying error.message shows a clear error description to the user.
Fix the error in the ErrorBoundary component to correctly catch errors in Remix.
export function ErrorBoundary({ error }) {
return (
<main>
<h1>[1]</h1>
<p>{error.message}</p>
</main>
);
}The ErrorBoundary should render a user-friendly message inside an element like h1.
Fill both blanks to create a functional ErrorBoundary component that logs the error and shows a message.
export function ErrorBoundary({ error }) {
console.[1](error);
return <div role="alert">[2]</div>;
}Use console.log to log the error and show a clear alert message to users.
Fill all three blanks to create an accessible and responsive ErrorBoundary component.
export function ErrorBoundary({ error }) {
console.[1](error);
return (
<section aria-live="assertive" className="[2]">
<h2>[3]</h2>
<p>{error.message}</p>
</section>
);
}Use console.log to log errors, apply Tailwind CSS classes for styling, and provide a clear heading.
