react的类组件调用-引用js类

class(login.js)

class LoginClass extends React.Component{
    render(){
         return (
            <h2>LoginClass-Class</h2>
        )
     }
}
 
ReactDOM.render(<LoginClass />,document.getElementById('root'));

html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>

<link rel="icon" href="img/favicon.ico" type="image/x-icon" />

<script src="js/react.development.js"></script>
<script src="js/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<script src="/js/login.js" type="text/babel"></script> 
    
</head>
<body>
    <div id="root"></div>
</body>
</html>

 

posted @ 2022-05-14 09:06  阿日斯兰  阅读(374)  评论(0编辑  收藏  举报