Step 2 chapter 4 : componentWillUpdate


#1

Code will not go through, workspace will not reset and when the popup displays “get code” it freezing / loses connection to this website and will not display the code.

has anyone pass this ? If so can you post the code of all files in your workspace?

var React = require(‘react’);
var ReactDOM = require(‘react-dom’);
var yellow = ‘rgb(255, 215, 18)’;

var TopNumber = React.createClass({
propTypes: {
number: React.PropTypes.number,
game: React.PropTypes.bool
},

getInitialState: function () {
return { ‘highest’: 0 };
},
componentWillUpdate: function (nextProps, nextState) {
if (document.body.style.background != yellow && this.state.highest >= 950*1000) {
document.body.style.background = yellow;
} else if (!this.props.game && nextProps.game) {
document.body.style.background = ‘white’;
}
},
render: function () {
return (


Top Number: {this.props.number}


);
}
});

module.exports = TopNumber;


#2

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