Skip to content

Instantly share code, notes, and snippets.

@oshell
Last active December 9, 2018 12:34
Show Gist options
  • Select an option

  • Save oshell/4de98386f413191a393396df04700b93 to your computer and use it in GitHub Desktop.

Select an option

Save oshell/4de98386f413191a393396df04700b93 to your computer and use it in GitHub Desktop.
class App extends Component {
constructor(props){
super(props);
this.state = {
restaurants: initialRestaurants,
sorting: initialSorting,
}
this.toggleFavourite = this.toggleFavourite.bind(this);
this.sort = this.sort.bind(this);
this.search = this.search.bind(this);
}
getRestaurants() {...}
toggleFavourite(element) {...}
sort(array, property, sorting) {...}
search(term) {...}
// return JSX
render() {
return(
<Container>
<SearchBar
search={this.search}
sort={this.sort}
sorting={this.sorting}/>
<RestaurantList
restaurants={this.restaurants}
toggleFavorite={this.toggleFavourite} />
</Container>
);
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment