Update React.DOM -> React.createElement through docs

This commit is contained in:
Paul O’Shannessy committed 2014-10-28 11:06:30 -07:00
1 parent 0344aaf18d
commit eb2827ec6a
8 files changed
+13 -13

No files matched your search

+3 -3
View File
@@ -90,14 +90,14 @@ The first thing you'll notice is the XML-ish syntax in your JavaScript. We have
var CommentBox = React.createClass({displayName: 'CommentBox',
render: function() {
return (
React.DOM.div({className: "commentBox"},
React.createElement('div', {className: "commentBox"},
"Hello, world! I am a CommentBox."
)
);
}
});
React.render(
CommentBox(null),
React.createElement(CommentBox, null),
document.getElementById('content')
);
```
@@ -158,7 +158,7 @@ var CommentBox = React.createClass({
});
```
Notice how we're mixing HTML tags and components we've built. HTML components are regular React components, just like the ones you define, with one difference. The JSX compiler will automatically rewrite HTML tags to "React.DOM.tagName" expressions and leave everything else alone. This is to prevent the pollution of the global namespace.
Notice how we're mixing HTML tags and components we've built. HTML components are regular React components, just like the ones you define, with one difference. The JSX compiler will automatically rewrite HTML tags to `React.createElement(tagName)` expressions and leave everything else alone. This is to prevent the pollution of the global namespace.
### Component Properties