Quantcast
Channel: User Brett Merrifield - Stack Overflow
Viewing all articles
Browse latest Browse all 37

Comment by Brett Merrifield on TypeError: _this.state.answers.push is not a function React

$
0
0
Try using the prevState classback for setState when comparing to the current state. For example: this.setState(prevState => ({ answers: [ ...prevState.answers, { answerChoice: '', key: uuid() } ] }));

Viewing all articles
Browse latest Browse all 37

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>