Last active
July 29, 2016 04:11
-
-
Save theonlyrao/69aa0e53a2acf9de3611d6da3ea79b85 to your computer and use it in GitHub Desktop.
First attempt at render React component in new div
This file contains 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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
const Letter = React.createClass({ | |
render() { | |
return ( | |
// lots of HTML stuff here... | |
) | |
} | |
}); | |
var CapitalAButton = React.createClass({ | |
getInitialState: function(){ | |
return { showCapitalA: false }; | |
}, | |
showCapitalA: function(){ | |
this.setState({ | |
showCapitalA: true | |
}); | |
}, | |
render: function() { | |
return ( | |
<div id="capital-button" onClick={this.showCapitalA}> | |
A | |
{ this.state.showCapitalA? ReactDOM.render(<Letter />, document.querySelector('#letter')) : null } | |
</div> | |
) | |
} | |
}); | |
var ButtonChoices = React.createClass({ | |
render: function() { | |
return ( | |
<CapitalAButton /> | |
) | |
} | |
}); | |
ReactDOM.render( | |
<div id="a"> | |
<ButtonChoices /> | |
</div>, | |
document.querySelector('#button-group') | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment