4. componentWillUpdate, part 2


#1

I entered the required command, but I got this error:

TypeError: Cannot read property 'game' of undefined
at [object Object].componentWillUpdate

Initially, I tried to type in the command myself and then I literally copy-pasted it from the instructions panel and still failed.
I also checked the 'Apps.js' file to see it there is a problem with the 'game' props, but everything is alright.

This is the required command:

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';
}

Any ideas?

PS: I also find it strange that they wrote 950,000 like 950*1000. Does React have a problem when parsing numbers like this one?


#2

Got stuck on that too. But I don't see any error message like that.

there is an error msg in the console though:

platform.bundle-23f7b68….js:32 Uncaught (in promise) Object {code: 600, message: "SyntaxError: /home/ccuser/workspace/learn-react-05…ode_modules/babylon/lib/plugins/flow.js:1063:30)↵", params: Object}(anonymous function) @ platform.bundle-23f7b68….js:32r.receive @ platform.bundle-23f7b68….js:23n.emit @ vendor.bundle-aa12f18….js:56r._onmessage @ platform.bundle-23f7b68….js:23
platform.bundle-23f7b68….js:32 Uncaught (in promise) Object {code: 600, message: "SyntaxError: /home/ccuser/workspace/learn-react-05…ode_modules/babylon/lib/plugins/flow.js:1063:30)↵", params: Object}(anonymous function) @ platform.bundle-23f7b68….js:32r.receive @ platform.bundle-23f7b68….js:23n.emit @ vendor.bundle-aa12f18….js:56r._onmessage @ platform.bundle-23f7b68….js:23

#3

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