Last active
August 26, 2018 00:03
-
-
Save joshmrallen/4b6215fe29e2b8afec013f8b9475828b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './App.css'; | |
import BusinessList from './components/BusinessList/BusinessList'; | |
import SearchBar from './components/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}); | |
});//Searching API, receiving response, and updating state with setState (review for documentation for understanding) | |
//Yay, finally part 4 functionality is here. Hurray for the API! | |
}//end searchYelp method | |
render() { | |
return ( | |
<div className="App"> | |
<h1>ravenous</h1> | |
<SearchBar searchYelp={this.searchYelp} /> | |
<BusinessList businesses={this.state.businesses} /> | |
</div> | |
);//end of return statement | |
}//end of render method | |
}//end of App class | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment