22-06-21 | 리액트 시계 만들기

Moon Hee·2022년 6월 21일
0

<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>리액트 시계</title>
</head>
<body>
    <div id="root"></div>

    <script src="https://unpkg.com/react@17/umd/react.development.js" crossorigin></script>
    <script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js" crossorigin></script>
    <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
    <script type="text/babel">
        function Clock(props) {
            return (
                <div>
                    <h1>리액트로 시계만들기</h1>
                    <h2>현재 시간: {new Date().toLocaleTimeString()}</h2>
                </div>
            );
        }


        setInterval(() => {
            ReactDOM.render(
                <React.StrictMode>
                    <Clock />
                </React.StrictMode>,
                document.getElementById('root')
            );
        }, 1000);
    </script>
</body>
</html>
profile
프론트엔드 개발하는 사람

0개의 댓글