Anyone stuck on step 2 of Chapter 4 - componentWillUpdate?

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
Lesson: Updating/Unmounting Lifecycle Methods
Chapter 4 - componentWillUpdate
Instruction 2 - adding if statement to componentWillUpdate

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>

I cannot get my code to pass when I hit run. I get no error message. After hitting run a few times a popup appears that gives me the option to get the correct code. This popup does not work.

After trying to figure out where I went wrong with my code, I copied and pasted everything directly from the instructions. The problem remains. This is the code:

```

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;

I should add that I already submitted a bug report, but I wanted to make sure I hadn't missed something obvious.
<do not remove the three backticks above>
1 Like

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