mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
17 lines
339 B
JavaScript
17 lines
339 B
JavaScript
import React from "react"
|
|
|
|
import "./index.less"
|
|
|
|
export default () => {
|
|
const [time, setTime] = React.useState(new Date())
|
|
|
|
React.useEffect(() => {
|
|
const interval = setInterval(() => {
|
|
setTime(new Date())
|
|
}, 1000)
|
|
|
|
return () => clearInterval(interval)
|
|
}, [])
|
|
|
|
return <div className="clock">{time.toLocaleTimeString()}</div>
|
|
} |