Write a simple React component that shows the current date using JavaScript's Date object.
EasyProblem Statement
Write a simple React component that shows the current date using JavaScript's Date object.
Sample Output
Today's date is: YYYY-MM-DD (e.g., Today's date is: 2024-11-12)
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
import React from "react";
const CurrentDate = () => {
const today = new Date();
// Format the date using today.getFullYear(), today.getMonth(), and today.getDate()
return (
// Return a JSX element displaying the formatted date
);
};
export default CurrentDate;
Expected Output
Today's date is: YYYY-MM-DD (e.g., Today's date is: 2024-11-12)