0.0.7 • Published 5 years ago

use-time-react-hook v0.0.7

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

useTime react hook

A React hook that makes your component aware of time.

npm install use-time-react-hook -S

Or

yarn add use-time-react-hook

Examples:

  • Refresh data at a latest time range:
import { useTime } from "use-time-react-hook";

const App = () => {
  const [time] = useTime({ range: "last 1 minutes", interval: "1 sec" });

  useEffect(() => {
    refreshData();
  }, [time]);

  return <div>...</div>;
};
import { useTime } from "use-time-react-hook";

const Clock = () => {
  const [time] = useTime();

  return <div> Now is ${new Date(time).toString()} </div>;
};
0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.1

5 years ago