Created
June 14, 2016 17:59
-
-
Save timsgardner/b524bd5b6ec02e5978f6a6d78a3e9b41 to your computer and use it in GitHub Desktop.
paragraph pile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ParagraphPile = React.createClass( | |
{getInitialState: function(){ | |
return({tog: false}); | |
}, | |
handleClick: function(e){ | |
labeledLog('state', this.state); | |
e.preventDefault(); | |
var tog2 = !(this.state.tog); | |
this.setState({tog: tog2}); | |
}, | |
render: function(){ | |
labeledLog("props", this.props); | |
var colorName; | |
if(this.state.tog){ | |
colorName = 'blue'; | |
}else{ | |
colorName = 'red'; | |
} | |
return( | |
<div className="paragraphHolder" | |
onClick = {this.handleClick}> | |
<div className={colorName}> | |
{this.props.textData.map(function(td){ | |
return(<p>{td}</p>); | |
} | |
)} | |
</div> | |
</div> | |
); | |
}} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment