💻 آخرین فرصت یادگیری برنامه‌نویسی با آفر ویژه قبل از افزایش قیمت در ۱۵ آذر ماه (🎁 به همراه یک هدیه ارزشمند )
۰ ثانیه
۰ دقیقه
۰ ساعت
۲ رضا شاکری
حل تمرین جلسه نحوه ساخت functinal component
جامعه ری اکت ایجاد شده در ۰۱ دی ۱۴۰۲
<!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>
    <div id="root"></div>
    <script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
    <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 TodoList() {
            return  <div className="todo-list">
              			<div className="todo-item">
                    		<input type="checkbox" />
                    		<span className="todo-content">task 1</span>
                		</div>
            		</div>
        }
        function Container() {
            return <div className="container">
            <TodoApp />
            <TodoList />
        </div>
        }
        ReactDOM.render(<Container />, document.getElementById('root'))
    </script>
</body>
</html>

موفق باشید.

محسن موحد ۰۱ دی ۱۴۰۲، ۱۹:۴۰

<!DOCTYPE html>

<!-- saved from url=(0044)file:///C:/Users/k3500/Desktop/Practice.html -->

<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; 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;

        }


 

        .todo-item{

            margin-left: 300px;

            font-size: 30px;

        }

    </style>

<script>"use strict";


 

function Queztion() {

  return /*#__PURE__*/React.createElement("div", {

    id: "todo-app"

  }, /*#__PURE__*/React.createElement("label", {

    className: "todo-label",

    forhtml: "new-todo"

  }, "What do you want to do today?"));

}

function Awnser() {

  return /*#__PURE__*/React.createElement("div", {

    id: "todo-app"

  }, /*#__PURE__*/React.createElement("input", {

    type: "text",

    id: "new-todo",

    className: "todo-input",

    placeholder: "type your tasks"

  }));

}

function CheckBox() {

  return /*#__PURE__*/React.createElement("div", {

    className: "todo-item"

  }, /*#__PURE__*/React.createElement("input", {

    type: "checkbox"

  }), /*#__PURE__*/React.createElement("span", {

    className: "todo-content"

  }, "task 1"));

}

function Practice() {

  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Queztion, null), /*#__PURE__*/React.createElement(Awnser, null), /*#__PURE__*/React.createElement(CheckBox, null));

}

ReactDOM.render( /*#__PURE__*/React.createElement(Practice, null), document.getElementById('root'));

//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjoz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hCTixLQUFBLENBQUFDLGFBQUE7SUFBTUUsU0FBUyxFQUFDO0VBQWMsR0FBQyxRQUFZLENBQzFDLENBQUM7QUFDZDtBQUVBLFNBQVNNLFFBQVFBLENBQUEsRUFBRTtFQUNmLG9CQUFPVCxLQUFBLENBQUFDLGFBQUEsMkJBQ09ELEtBQUEsQ0FBQUMsYUFBQSxDQUFDRixRQUFRLE1BQUMsQ0FBQyxlQUNYQyxLQUFBLENBQUFDLGFBQUEsQ0FBQ0ksTUFBTSxNQUFDLENBQUMsZUFDVEwsS0FBQSxDQUFBQyxhQUFBLENBQUNPLFFBQVEsTUFBQyxDQUNmLENBQUM7QUFDZDtBQUVBRSxRQUFRLENBQUNDLE1BQU0sZUFBQ1gsS0FBQSxDQUFBQyxhQUFBLENBQUNRLFFBQVEsTUFBQyxDQUFDLEVBQUdHLFFBQVEsQ0FBQ0MsY0FBYyxDQUFDLE1BQU0sQ0FBQyxDQUFDIiwiaWdub3JlTGlzdCI6W119</script></head>


 

<body>


 

    <div id="root"><div><div id="todo-app"><label class="todo-label" forhtml="new-todo">What do you want to do today?</label></div><div id="todo-app"><input type="text" id="new-todo" class="todo-input" placeholder="type your tasks"></div><div class="todo-item"><input type="checkbox"><span class="todo-content">task 1</span></div></div></div>


 

    <script crossorigin="" src="./Practicee_files/react.development.js.download"></script>

    <script crossorigin="" src="./Practicee_files/react-dom.development.js.download"></script>

    <script src="./Practicee_files/babel.min.js.download"></script>


 

<script type="text/babel">


 

    function Queztion() {

        return <div id="todo-app">


 

            <label className="todo-label" forhtml="new-todo">What do you want to do today?</label>

            </div>

    }


 

    function Awnser() {

        return <div id="todo-app">

       

            <input type="text" id="new-todo" className="todo-input" placeholder="type your tasks"/>

        </div>

    }


 

    function CheckBox() {

        return <div className="todo-item">

                <input type="checkbox"/>

                <span className="todo-content">task 1</span>

            </div>

    }


 

    function Practice(){

        return <div>

                      <Queztion/>

                      <Awnser/>

                      <CheckBox/>

            </div>

    }


 

    ReactDOM.render(<Practice/> , document.getElementById('root'))


 

</script>






 

</body></html>

سعید شاهملکی ۰۱ اردیبهشت ۱۴۰۳، ۲۲:۵۰