@uneksija/usetime
v1.2.4
Published
time hook
Downloads
7
Readme
usetime
(P)react hook for realtime Date object
Installation
npm install @uneksija/usetime
Importing the hook
import useTime from `@uneksija/usetime` // for Preact
import useTime from `@uneksija/usetime/react` // for React
Example usage
function App() {
const time = useTime() // returns a Date object
return <span>{time.toLocaleString()}</span>
}