🚀 تخفیف ۳۵٪ + ۳.۵ میلیون هدیه! برنامه‌نویسی رو الان شروع کن - فقط امروز!
۰ ثانیه
۰ دقیقه
۰ ساعت
۱ مریم جعفرتبار
functional component practice
جامعه ری اکت ایجاد شده در ۱۳ مرداد ۱۴۰۴
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        .container {
            max-width: 300px;
            display: flex;
            flex-direction: column;
            margin: 0 auto;
        }
        #todo-app {
            margin: 1em;
            text-align: center;
        }
        #todo-list,
        #todo-stats {
            margin: 1em auto;
            text-align: left;
            width: 450px;
        }
        #todo-list {
            list-style: none;
            padding: 0;
        }
        #todo-stats {
            color: #777;
        }
        #new-todo {
            border-radius: 5px;
        }
        .todo-input {
            display: block;
            font-family: Helvetica, sans-serif;
            font-size: 20px;
            line-height: normal;
            margin: 5px auto 0;
            padding: 6px;
            width: 420px;
        }
        .todo-label {
            color: #444;
            font-size: 20px;
            font-weight: bold;
            text-align: center;
        }
    </style>
</head>
<body>
    <script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
    <div id="root"></div>
    <script type="text/babel">
    function TodoApp(){
        return <div id="todo-app">
            <label className="todo-label" htmlfor="new-todo">What do you want to do today?</label>
            <input type="text" id="new-todo" className="todo-input" placeholder="type your tasks"/>
        </div>;
    }
    function TodoItem(){
        return <div className="todo-item">
                <input type="checkbox"/>
                <span className="todo-content">task 1</span>
            </div>;
    }
    function TodoList(){
        return <TodoItem/>;
    }
    function Container(){
        return <div className='container'>
                <TodoApp/>
                <TodoList/>
            </div>;
    }
    ReactDOM.render(<Container/>, document.getElementById('root'));
    </script>
</body>
</html>

خسته نباشید.

محسن موحد ۱۴ مرداد ۱۴۰۴، ۰۴:۱۸