const [date, setDate] = useState(new Date()); useEffect(() => { var timerID = setInterval( () => setDate(new Date()), 1000 ); return function cleanup() { clearInterval(timerID); }; }); return (

Today

{date.toLocaleDateString()}

Time

{date.toLocaleTimeString()}

);