use pure function instead of creating class
This commit is contained in:
12
j/jsx.js
12
j/jsx.js
@@ -1,12 +1,8 @@
|
|||||||
var React = require('react');
|
var React = require('react');
|
||||||
|
|
||||||
var HelloWorld = React.createClass({
|
var HelloWorld = function() {
|
||||||
displayName: 'HelloWorld',
|
return <span>Hello World</span>;
|
||||||
render: function() {
|
};
|
||||||
return (
|
HelloWorld.displayName = 'HelloWorld';
|
||||||
<span>Hello World</span>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(React.renderToString(<HelloWorld />));
|
console.log(React.renderToString(<HelloWorld />));
|
||||||
|
|||||||
Reference in New Issue
Block a user