realtime-data-cli-tool
Version:
A real-time data dashboard CLI tool built with Ink, React, and TypeScript that displays live ISS location, weather, Bitcoin prices, random facts, and inspirational quotes
12 lines (11 loc) • 351 B
JavaScript
import { useState, useEffect } from 'react';
export const useCurrentTime = () => {
const [currentTime, setCurrentTime] = useState(new Date());
useEffect(() => {
const timer = setInterval(() => {
setCurrentTime(new Date());
}, 1000);
return () => clearInterval(timer);
}, []);
return currentTime;
};