I have a react component wihch contains two child components, In the parent component i have a button that launches a function to change style in both the parent and the child. I managed to change the style in the parent but not in the child here's what i've done
var XBlockButtons = React.createClass({
getInitialState(){
return{
Componentstyle:{display:"block"},
HTMLstyle:{display:"none"},
}
},
showhtml(){
this.setState({
Componentstyle:{display:"none"},
HTMLstyle:{display:"block"}
})
},
render: function() {
var style={display:'block'}
return (
<div className="add-xblock-component new-component-item adding">
<div className="new-component" style={this.state.Componentstyle}>
<ul className="new-component-type" >
<li>
<button type="button" className="multiple-templates add-xblock-component-button" data-type="html" onClick={this.showhtml}>
<span className="large-template-icon large-html-icon"></span>
<span className="sr"> Add Component:</span>
<span className="name">HTML</span>
</button>
</li> /ul></div>
<HTML/>
-----Child-----
var HTML = React.createClass({
render:function(){
return(
<div className="new-component-templates new-component-html" style={this.state.HTMLstyle}></div>);})};