Top 10 JavaScript Errors From 1000+ Projects (and How to Avoid Them)

class Quiz extends Component {
  // Added this:
  constructor(props) {

    // Assign state itself, and a default value for items
    this.state = {
      items: []

  componentWillMount() {
    axios.get('/thedata').then(res => {

  render() {
    return (
        { =>
          <li key={}>{}</li>

The exact code in your app might be different, but we hope we’ve given you enough of a clue to either fix or avoid this problem in your app. If not, keep reading because we’ll cover more examples of related errors below.

2. TypeError: ‘undefined’ Is Not an Object (evaluating…)

This is an error that occurs in Safari when you read a property or call a method on an undefined object. You can test this very easily in the Safari Developer Console. This is essentially the same as the above error for Chrome, but Safari uses a different error message.

Prev2 of 7Next

Leave a Reply

Your email address will not be published. Required fields are marked *