Skip to content

React16.2的Fragment语法糖的支持

司徒正美 edited this page Dec 27, 2017 · 1 revision
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">   
    <script type='text/javascript' src="./dist/React.js"></script>
  
    <script type='text/javascript' src="https://unpkg.com/@babel/standalone/babel.js"></script>
</head>
<body>
    
        <h1>测试</h1>
        <h1 id='app-root' className="root">

        </h1>
        <h1 id='modal-root' className="model">
            
                    </h1>
        <script type='text/babel'>
            var check = function () {
                return null;
            };
            check.isRequired = check;
            var PropTypes = React.PropTypes || {
                string: check
            }
            if(!window.ReactDOM){
              window.ReactDOM = React
            }
            var container = document.getElementById("app-root")
            var expect = function(a) {
                return {
                    toBe: function(b) {
                        console.log(a,"vs", b, a === b)
                    },
                    toEqual(b){
                        console.log(a,"vs", b, a +""=== b+"")
                    },
                    toThrow(b){
                        try{
                            a()
                        }catch(e){
                            console.log(e,"vs", b, e.message +""=== b+"")
                        }
                    }
                }
            }
            ReactDOM.render(<><p>111</p><p>222</p></>,container)

 
          </script>

</body>
    
 </html>