Reactreact & vue & angular

react学习(5)jsx语法

2022-08-08  本文已影响0人  哆啦C梦的百宝箱
知识点

1: jsx语法规则

<!DOCTYPE html>
<html lang="en">
<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>react</title>
</head>
<body>
    <div id="test"></div>
    <script type="text/javascript" src="../js/react.development.js"></script>
    <script type="text/javascript" src="../js/react-dom.development.js"></script>
    <script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
    <script type="text/babel">
        const myId="Niuniu";
        const myText ="hellO";
        const vDOM =(
            <div>
                <h1 id={myId.toLocaleLowerCase()}>
                    <span style={{color:'red'}}>{myText.toLocaleLowerCase()}</span>
                </h1>
                <input type="text"/>
            </div>
        );
        ReactDOM.render(vDOM,document.getElementById('test'));
    </script>
    
</body>
</html>
上一篇下一篇

猜你喜欢

热点阅读