Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Created November 24, 2018 14:42
Embed
What would you like to do?
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