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 HelloWorld = React.createClass({
|
||||
displayName: 'HelloWorld',
|
||||
render: function() {
|
||||
return (
|
||||
<span>Hello World</span>
|
||||
);
|
||||
}
|
||||
});
|
||||
var HelloWorld = function() {
|
||||
return <span>Hello World</span>;
|
||||
};
|
||||
HelloWorld.displayName = 'HelloWorld';
|
||||
|
||||
console.log(React.renderToString(<HelloWorld />));
|
||||
|
||||
Reference in New Issue
Block a user