Programming Exercises

Create a component that displays an error message when a specific condition is met.

Easy

Problem 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;
Log in or sign up to run or submit your code.Log inSign up
Input
errorCondition = true
Expected Output
Error: Something went wrong! (when the condition is true)