Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Created November 24, 2018 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save productioncoder/2375a37937399c324f3beeee54e16459 to your computer and use it in GitHub Desktop.
Save productioncoder/2375a37937399c324f3beeee54e16459 to your computer and use it in GitHub Desktop.
Youtube in React: update render function for search component + add infinite scroll
/* ... */
import {VideoList} from '../../components/VideoList/VideoList';
class Search extends React.Component {
render() {
return (
<VideoList
bottomReachedCallback={this.bottomReachedCallback}
showLoader={true}
videos={this.props.searchResults}/>
);
}
/* ... */
bottomReachedCallback = () => {
if(this.props.nextPageToken) {
this.props.searchForVideos(this.getSearchQuery(), this.props.nextPageToken, 25);
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment