LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code
JS
var App = React.createClass({
  getInitialState: function() {
    return {
      bgColor: 'teal'
    }
  },
  handleColorChange: function(color) {
    this.setState({ bgColor: color })
  },
  updateBackgroundColor: function() {
    var body = document.querySelector('body')
    body.style.background = this.state.bgColor
  },
  componentDidMount: function() {
    this.updateBackgroundColor()
  },
  componentDidUpdate: function() {
    this.updateBackgroundColor()
  },
  render: function() {
    return (
      

Hello, World!

) } }); var ColorPicker = React.createClass({ propTypes: { value: React.PropTypes.string.isRequired, onColorChange: React.PropTypes.func }, handleChange: function(e) { e.preventDefault(); var color = e.target.value if (this.props.onColorChange) { this.props.onColorChange(color); } }, render: function() { return ( ) } }); React.render(, document.querySelector('#main'))
Wed, 12/27/2017 - 07:03

Related Codes

Pen ID
Pen ID
Pen ID
Square Adv