0
我已經在ReactJS中編寫了一個簡單的hello世界代碼,但是當我運行代碼時,瀏覽器什麼都不顯示。控制檯上沒有顯示任何錯誤。請告訴可能是什麼問題。我使用WebStrom編譯器,Chrome作爲瀏覽器,Windows 8.1是操作系統。瀏覽器不顯示/執行ReactJS代碼
的index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>First React App</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/JSXTransformer.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="script.jsx" type="text/babel"></script>
</head>
<body>
<div id="content"></div>
</body>
</html>
的script.js
var MyComponent = React.createClass({
render :function() {
return(
<h2>Heading 2</h2>
);
}
});
React.render(
<MyComponent/>, document.getElementById('content')
);
項目目錄
瀏覽器顯示
您使用的WebPack?讓我們來看看這個配置。 – 1252748