EDIT Just saw the comments and that zerkms has already provided you with a solution. I will leave my answer for clarification.
Your problem is that inside
handleClickMethod you are calling
shuffleCards instead of
this.shuffleCards shuffleCards(array) { // ... } handleClickEvent(event) { // ... if (this.state.count == 0) { cards = this.shuffleCards(cards); // here you should use `this.` } }
The reason is that the shuffleCards method shuffleCards defined on your component, which is accessible from its methods using the this property.
If you defined shuffleCards in handleClickMethod , you can call it without access to this :
handleClickEvent(event) { function shuffleCards(array) {
source share