Created
April 17, 2016 23:40
-
-
Save fay-jai/8ace5177c387791e869c0134fefd6b46 to your computer and use it in GitHub Desktop.
React Elements - Hello World
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
// This uses JSX syntax. | |
var helloWorld = <div>Hello World!</div>; | |
// And this is what the JSX syntax compiles into in JavaScript: | |
var helloWorld = React.createElement( | |
"div", | |
null, | |
"Hello World!" | |
); | |
// And this produces a plain old JavaScript object that looks something like this: | |
var helloWorld = { | |
key: null, | |
props: { | |
children: "Hello World!" // more stuff in here | |
}, | |
ref: null, | |
type: "div" | |
// more stuff in here | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment