Skip to content

Instantly share code, notes, and snippets.

@fay-jai
Created April 17, 2016 23:40
Show Gist options
  • Save fay-jai/8ace5177c387791e869c0134fefd6b46 to your computer and use it in GitHub Desktop.
Save fay-jai/8ace5177c387791e869c0134fefd6b46 to your computer and use it in GitHub Desktop.
React Elements - Hello World
// 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