You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, I'm rending stuff using ReactLayout (as a 'layout manager'), and what I'm having problems understanding is...how are you supposed pass props down from App -> Layout -> Page, if you can't (I don't see how) pass props down through {this.props.content}?
Say I have a function thisFunc() in App that I want to pass down to a grandchild component...how're you supposed to go about that? Ordinarily, I'd just do something like , but since you're using {this.props.content} to render components...I don't know how the chain is supposed to work.
Insights?
The text was updated successfully, but these errors were encountered:
Basically, you change the layout template code from:
MainLayout=React.createClass({render(){return<div><header>
This is our header
</header><main>{this.props.content}</main><footer>
This is our footer
</footer></div>}});
to
MainLayout=React.createClass({render(){return<div><header>
This is our header
</header><main>{React.cloneElement(this.props.content,{someProp: this.thisFunc})}</main><footer>
This is our footer
</footer></div>}});
So, I'm rending stuff using ReactLayout (as a 'layout manager'), and what I'm having problems understanding is...how are you supposed pass props down from App -> Layout -> Page, if you can't (I don't see how) pass props down through {this.props.content}?
Say I have a function thisFunc() in App that I want to pass down to a grandchild component...how're you supposed to go about that? Ordinarily, I'd just do something like , but since you're using {this.props.content} to render components...I don't know how the chain is supposed to work.
Insights?
The text was updated successfully, but these errors were encountered: