Ravenous Part 4 Failed to compile

Hi All :slight_smile:

This is the error message I get, I don’t understand why it’s needed a semicolon there…this is my code…

import React from 'react';
import './App.css';

import BusinessList from '../BusinessList/BusinessList';
import SearchBar from '../SearchBar/SearchBar';
import Yelp from '../../util/Yelp';

class App extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      businesses: [],
    };

    this.searchYelp = this.searchYelp.bind(this);
  }
searchYelp(term, location, sortBy) {
  Yelp.search(term, location, sortBy).then(businesses => {
    this.setState({businesses: businesses});
  });
}

}
render() {
  return (
    <div className="App">
      <h1>ravenous</h1>
      <SearchBar searchYelp={this.searchYelp} />
      <BusinessList businesses={this.state.businesses} />
    </div>
  );
}
}

export default App;

This is one of those times that the error message isn’t super helpful. In those cases, I’ve found I often need to look above where the error is pointing to understand why it can’t compile.

In this case, you have an extra } so your entire render() block of code is outside of the class

1 Like

Thank you ! Eagle eyes.

Now I have 2 different errors in VS and localhost… how is this possible ?

vs

From that sceenshot, it looks like you removed one too many } (or perhaps not the correct one).

Notice that your render() block now looks complete, but that also means the final curly brace to close the class isn’t there. Is render() inside the class?