Modifying this.props.children
"Shawn. There is one special prop that we should know about. It's this.props.children
," continued Mike.
"React captures all the children that are present in the opening and closing tag into props that can be accessed through this.props.children
." said Mike.
"Let's try to modify our code to use this.props.children
. This is also required as we want to display a header for our output table." Mike added.
var RecentChangesTable = React.createClass({ render: function(){ return( <div> <h1> Recent Changes </h1> <table className='table'> {this.props.children} </table> </div> ); } }); var App = React.createClass({ render: function(){ return(<RecentChangesTable> <Headings headings = {this.props.headings} /> <Rows changeSets = {this.props.changeSets} /> </RecentChangesTable>);...