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