Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

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

Try your code in this preview. Submit marks it done.

import React from "react";
 
 const ErrorMessage = () => {
  const errorCondition = true;
 
  return (
  // Conditionally render the error message
    <></>
  );
 };
 
 export default ErrorMessage;