Create a component that displays an error message when a specific condition is met.
EasyProblem Statement
Create a component that displays an error message when a specific condition is met.
Sample Input
errorCondition = true
Sample Output
Error: Something went wrong! (when the condition is true)
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
import React from "react";
const ErrorMessage = () => {
const errorCondition = true;
return (
// Conditionally render the error message
<></>
);
};
export default ErrorMessage;
Input
errorCondition = true
Expected Output
Error: Something went wrong! (when the condition is true)