ClarkPamler93 ClarkPamler93 - 1 year ago 154
Javascript Question

React.js Not Rendering?

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>

<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>

<div id="root"></div>



// Code goes here

var Button = React.createClass({
render: function() {
return ( < button > Go < /button>)

React.render( < Button / > , document.getElementById("root"));

Answer Source

I have corrected your codes, and put in this jsfiddle :

Your last line is wrong, it should be like so:

ReactDOM.render( < Button / > , document.getElementById("root"));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download