Created
November 24, 2018 14:42
-
-
Save productioncoder/2375a37937399c324f3beeee54e16459 to your computer and use it in GitHub Desktop.
Youtube in React: update render function for search component + add infinite scroll
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 {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