In react you can do something like:
var Wrap = React.createClass({ render: function() { return <div>{ this.props.children }</div>; } }); var App = React.createClass({ render: function() { return <Wrap><h1>Hello word</h1></Wrap>; } }); This allows you to pass in a component to another. But what if Wrap had another div that you could put content into. So consider the following:
var Wrap = React.createClass({ render: function() { return ( <div> <ul className="icons"> // Another compoent should be passed here from App to render icons. </ul> { this.props.children } </div> ); } }); var App = React.createClass({ render: function() { return <Wrap><h1>Hello word</h1></Wrap>; } }); In the above example you can see that not only do I want to pass in children of the App component but I also want to pass another component that is icons for the ul section. Is this possible?
If so, how?
<Icons />, which returns the<ul>, and whatever goes inside{ this.props.children}. Then inAppyou can instantiate two different components rather than one. I think you'll continue to feel like you're fighting React if you pass components as props.