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
Log in to submit00:00
Try your code in this preview. Submit marks it done.
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;