Random Color Picker (issue with random color button)

Hi there,

I’m having issues the this project, it was working fine until the last step and I realised the button won’t render a random color.

I’ve been checking each line and honestly cannot figure out what is wrong with it.

Any help will be greatly appreciated!

Thank you!

this is my code

2 Likes

Hi @cindycheung

handleClick() {
    this.setState = ({
      color: this.chooseColor()
    });
  }

setState should be a function call, not an assignment. So write

this.setState({
      color: this.chooseColor()
});

instead.

3 Likes

@mirja_t Thank you so much! I could not spot that last night nor this morning!

Thank you for pointing it out to me!

1 Like