Skip to content

Instantly share code, notes, and snippets.

@sfroestl
Created March 2, 2016 06:45
Show Gist options
  • Save sfroestl/9988193a2910e3515b74 to your computer and use it in GitHub Desktop.
Save sfroestl/9988193a2910e3515b74 to your computer and use it in GitHub Desktop.
import React from 'react';
class InfiniteScroll extends React.Component {
displayName: 'InfiniteScroll';
renderLoadMore() {
return <button
className='button'
onClick={ this.onloadMore.bind(this) }>
Load more
</button>;
}
renderLoadingSpinner() {
return <button
className='button'
disabled={true}
>
<i className='icon-refresh icon-spin'></i> Loading…
</button>;
}
onloadMore() {
this.props.loadMore();
}
render() {
return (
<div>
{ this.props.children }
{ this.props.isLoading ? this.renderLoadingSpinner() : this.renderLoadMore() }
</div>
);
}
}
export default InfiniteScroll;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment