/
githubmirror
/
jest
Обзор
Документация
Войти
/
githubmirror
/
jest
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
examples/snapshot/Clock.js
19 строк
479 B
Paul O’Shannessy
Update copyrights with Meta Platforms, restore original license in Jasmine fork (#13879)
09 фев 2023, 10:13
Не верифицирован
09 фев 2023, 10:13
6d2632a
Код
Авторство
О чём код?
// Copyright (c) Meta Platforms, Inc. and affiliates.. All Rights Reserved. import {useEffect, useState} from 'react'; export default function Clock() { const [seconds, setSeconds] = useState(Date.now() / 1000); const tick = () => { setSeconds(Date.now() / 1000); }; useEffect(() => { const timerID = setInterval(() => tick(), 1000); return () => clearInterval(timerID); }, []); return <p>{seconds} seconds have elapsed since the UNIX epoch.</p>; }