Lifecycle methods: 2 of 7: missing TopNumber.js


#1

I have trouble getting TopNumber.js

TopNumber.js has been moved. This will cause problems with this
exercise, please move TopNumber.js back to its original location, or
reset your files. How to fix it?

Thanks. JEG


#2

Move TopNumber.js to its original place. It should be in files.


#3

topNumber.js doesn't appear in the files


#4

please at least provide the exact code of topNumber so that it can be recreated it


#5

some problem with you


#6

I am seeing the same issue. Tried cache clear, logging back in, exercise reset, Topnumber.js still missing. Looks like perhaps also the code itself in the other files becomes corrupted.


#7

Please fix this! I have the same issue, TopNumber.js just went and is nowhere to be found. Instead, Headline.js is showing up in the tabs.


#8

Is this probem solved? I have the same, TopNumber.js is missing or moved. pls advice


#9

Buuuump. This whole exercise 2,3 and also 4 is buggy. The site wants u to sign up for pro. No way in ■■■■ if non pro is this buggy


#10

When it stays this buggy I will not sign up up for pro. In the mean time I donn't make anny progress, is their nobody who got passed this chapter and can help out?


#11

I have got the exact same issue. It just won't give me the standard "Top Number.js" file. I also tried to clear my Cache, relogging and restarting my browser.


#12

I copied and pasted this in a newly created TopNumber.js file and it worked!

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

  render: function () {
    return (
      <h1>
        Top Number: {this.props.number}
      </h1>
    );
  }
});

module.exports = TopNumber;

#13

Hello guys.

This is a working version of TopNumber.js - just copy paste it and it will allow you to move to the next course.

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

   componentWillReceiveProps: function (nextProps) {
      if (nextProps.number > this.state.highest) {
    this.setState({
      'highest' : nextProps.number
    });
      }
},
  
  
  render: function () {
    return (
      <h1>
        Top Number: {this.state.highest}
      </h1>
    );
  }
});

module.exports = TopNumber;

This ReactJS course is amazing, even with this minor bug / annoyance.


#14

@chiprunner79610 thanks for this code can you please post the working code for Target.js for the next exercise


#15

Hello Objectrunner40997.

This is Target.js in "3 / 7 shouldComponentUpdate" - please note that I did not find any bugs / problems in step 3 / 7.

var React = require('react');
var random = require('./helpers').random;

var Target = React.createClass({
  propTypes: {
    number: React.PropTypes.number.isRequired
  },
  
  shouldComponentUpdate : function (nextProps, nextState) {
    return this.props.number != nextProps.number;
  },

  render: function () {
    var visibility = this.props.number
      ? 'visible' : 'hidden';
    var style = {
      position: 'absolute',
      left: random(100) + '%',
      top:  random(100) + '%',
      fontSize: 40,
      cursor: 'pointer',
      visibility: visibility
    };

    return (
      <span 
        style={style} 
        className="target" >
        {this.props.number}
      </span>
    )
  }
});

module.exports = Target;

#16

I cannot find the target.js in my files and i had tried many times to create it with the code but it doesn't work even your code doesn't working i don't know what's the problem with this exercise


#17

Is there any way to reset the exercise in 3/7 when i am trying to reset the exercise it says workspace not restored. Please any help with this. Thanks in advance


#18

Thanks a lot, chiprunner79610! Pasting in your code 'fixed' it for me, i.e. allowed me to continue with the course. Wasn't able to reset or restore TopNumber.js either.