Programming Exercises

Write a React component that accepts a hardcoded name prop and displays 'Hello, {name}!'.

Easy

Problem Statement

Write a React component that accepts a hardcoded name prop and displays 'Hello, {name}!'.

Sample Input

name = 'John'

Sample Output

Hello, John!

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
import React from "react"; const Greeting = (props) => { // Return JSX to display the greeting using props.name }; export default Greeting;
Log in or sign up to run or submit your code.Log inSign up
Input
name = 'John'
Expected Output
Hello, John!