Responsive v16 and later
As with React v16, React components can return an array. This was not possible until v16.
To do this is simple:
return ([
<div key={0}> Hello Dear!</div>,
<div key={1}>{this.props.color}</div>
]);
, . , , . ,
, .
v15.6
React Components , <div>
.
, render()
- , . ( ).
, JSX, HTML. JSX - javascript. , :
React.createElement('div', null, 'Hello Dear!');
React, render()
, . , div
.
:
:
. <div>
, <Welcome />
.
, :
var George = React.createClass({
render: function(){
return (
<div>
<div> Hello Dear!</div>
<div>{this.props.color}</div>
</div>
);
}
});
ReactDOM.render(<George color="blue"/>, document.getElementById('div1'));