Use State to Toggle an Element challenge

Tell us what’s happening:

Your code so far


class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      visibility: false
    };
    // change code below this line
this.toggleVisibility=this.toggleVisibility.bind(this);

    // change code above this line
    
      }
  
  // change code below this line
toggleVisibility(){
  if(this.state.Visibility){
    this.setState({
      visibility:false
    });
  }else{
    this.setState({
      visibility:true
    });
  }
}
  // change code above this line
  render() {
    if (this.state.visibility) {
      return (
        <div>
          <button onClick={this.toggleVisibility}>Click Me</button>
          <h1>Now you see me!</h1>
        </div>
      );
    } else {
      return (
        <div>
          <button onClick={this.toggleVisibility}>Click Me</button>
        </div>
      );
    }
  }
};

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.75 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react/use-state-to-toggle-an-element/

I made a silly mistake,now it passed.Thank you randelldawson.

good day

i am struggling to understand how your toggleVisibility on line 7 of your code could have been defined if you used it before declaring the toggleVisibility function.
i am still a novice so please punch softly.

thank you