Last active
September 12, 2015 13:53
-
-
Save RyanAtViceSoftware/9119b93f94679e4d6741 to your computer and use it in GitHub Desktop.
Hello React Render Method - Paste the code below into https://facebook.github.io/react/jsx-compiler.html to see why you must have only a single root element in your JSX.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var HelloMessage = React.createClass({ | |
render: function() { | |
return <div>Hello React</div> // error: must return a single node | |
<div>How are you?</div> | |
} | |
}); | |
React.render(<HelloMessage/>, mountNode); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var HelloMessage = React.createClass({ | |
render: function() { | |
return <div> // works | |
<div>Hello React</div> | |
<div>How are you?</div> | |
</div> | |
} | |
}); | |
React.render(<HelloMessage/>, mountNode); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment