[React] new Date(), state를 활용한 동적인 현재시간 나타내기
·
Project/Timer Project
오류 import React, { useState } from 'react' export default function App() { const [timer, setTimer] = useState('0'); const currentTimer = () => { const date = new Date(); const hours = String(date.getHours()).padStart(2, "0"); const minutes = String(date.getMinutes()).padStart(2, "0"); const seconds = String(date.getSeconds()).padStart(2, "0"); return (`${hours}:${minutes}:${seconds}`) } const cu..