So I have decided to start learning React.js, but am having problems rendering into the HTML
Cant seem to see whats wrong any help would be great both the HTML and JSX are below
(Note Full links to the react library are there just could post them here since Stack doesnt allow URL Shortners)
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="react-15.2.1.js"></script>
<script src="react-dom-15.2.1.js"></script>
<script src="script.js"></script>
</head>
<body>
<div id="root"></div>
</body>
</html>
JSX
// Code goes here
var Button = React.createClass({
render: function() {
return ( < button > Go < /button>)
}
});
React.render( < Button / > , document.getElementById("root"));
I have corrected your code, and placed the working result in this fiddle:
Your last line was wrong, it should be like this:
ReactDOM.render( < Button / > , document.getElementById("root"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With