5/7 I can't finish this.state


#1

var React = require('react');

var green = '#39D1B4';
var yellow = '#FFD712';

var Toggle = React.createClass({
getInitialState: function () {
return { color: green };
},
changeColor: function () {
var newColor = this.state.color == green ? yellow : green;
this.setState({ color: newColor });
},
render: function () {
return (



Change my color



Change color


);
}
});
ReactDOM.render(,document.getElementById('app'))

This code appears 'import ReactDOM from 'react-dom' on line 2.'.

Please,help me


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.