Build a Random Quote Machine-UI disappears with enough click events

Tell us what’s happening:
I’ve managed to code my event handler in a way that a new quote returns on every click event but with enough click events the UI disappears and in the console logs ‘object error’.

I have no clue how to fix this problem.

Your code so far

class QuoteMachine extends React.Component{
constructor(props){
super(props);
this.state = {
quote: fullQuote,
}
this.handleClick = this.handleClick.bind(this);
}

handleClick(){
let copy = this.props.quotes.slice();
let index = Math.floor(Math.random() * copy.length);
this.setState(function(prevState,props){
if(prevState.quote != copy[index]){
return {quote: copy[index]}
}return {
quote: copy[index]}
})
}

render(){
const quote = this.state.quote[0];
const author = this.state.quote[1];
return (

    <div id='text'><h1> <div>{quote}</div> </h1></div>
    
    <div id='author'><h3> <div>{author}</div> </h3></div>
    
    <button onClick={this.handleClick} id='new-quote'>New Quote</button>
    <a id='tweet-quote' href="https://twitter.com/intent/tweet">Tweet Me</a>
  </div>
  )
} 

}
const QUOTES = [
[“Stay Hungry. Stay Foolish.”, “Steve Jobs”],
[“Good Artists Copy, Great Artists Steal.”, “Pablo Picasso”],
[“Argue with idiots, and you become an idiot.”, “Paul Graham”],
[“Be yourself; everyone else is already taken.”, “Oscar Wilde”],
[“Simplicity is the ultimate sophistication.”, “Leonardo Da Vinci”]
];
const fullQuote = QUOTES[Math.floor(Math.random() * QUOTES.length)]
ReactDOM.render(,
document.getElementById(‘node’))
Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/front-end-libraries-projects/build-a-random-quote-machine/

I went to your CodePen, And it seems to be working, I am not getting any errors, Did you fix it?

That’s because I uploaded the wrong version. Sorry I have multiple tabs of my quote machine up and must have linked the wrong one.

The correct version, the one that returns a new quote without repeating and crashes eventually is the one with the 2nd return in setState set to {quote: copy[index+1]}.

updated link: https://codepen.io/SuperBeowulf/pen/OddoVW