<script src="https://unpkg.com/react@17.0.2/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@17.0.2/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@babel/standalone@7.14.7/babel.min.js"></script>
<script type="text/babel">
const { useState, useEffect } = React;
const targetDate = new Date('2030-11-3').getTime(); // Change to your target date
const [timeLeft, setTimeLeft] = useState(calculateTimeLeft());
function calculateTimeLeft() {
const now = new Date().getTime();
const timeRemaining = targetDate - now;
if (timeRemaining <= 0) {
const days = Math.floor(timeRemaining / (1000 * 60 * 60 * 24));
const hours = Math.floor((timeRemaining % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((timeRemaining % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeRemaining % (1000 * 60)) / 1000);
const timer = setInterval(() => {
setTimeLeft(calculateTimeLeft());
<div className='container'>
<h3 className='heading'>React countdown timer days, hours, minutes, seconds</h3>
<span className='days'>{timeLeft.days} days</span>
<span className='hours'>{timeLeft.hours} hours</span>
<span className='minutes'>{timeLeft.minutes} minutes</span>
<span className='seconds'>{timeLeft.seconds} seconds</span>
ReactDOM.render(<App />, document.getElementById("app"));
font-family: Arial, sans-serif;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
/* Style for the countdown values */
background-color: #3498db;
/* Spacing between countdown values */
/* Center text horizontally */
transition: background-color 0.3s, color 0.3s;
/* Smooth color transition on hover */
/* Change cursor on hover */
background-color: #2980b9;
/* Darker background color on hover */
/* Text color on hover */