diff options
| author | taehoon <th.dev91@gmail.com> | 2019-02-13 22:52:57 -0500 |
|---|---|---|
| committer | taehoon <th.dev91@gmail.com> | 2019-02-20 13:30:30 -0500 |
| commit | f81b82b4714643ba396b69ca54b97259a36a6b9f (patch) | |
| tree | 2918dd22f091766ee87b96d79a0dcacdbc858274 /src/hocs/with_load_more | |
| parent | 8f608e060c813dc6d9aeeb548beca971ce9b74bd (diff) | |
Use hoc definitions to be factor of factory
Diffstat (limited to 'src/hocs/with_load_more')
| -rw-r--r-- | src/hocs/with_load_more/with_load_more.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/hocs/with_load_more/with_load_more.js b/src/hocs/with_load_more/with_load_more.js index 8877f8d3..28c741e3 100644 --- a/src/hocs/with_load_more/with_load_more.js +++ b/src/hocs/with_load_more/with_load_more.js @@ -3,8 +3,8 @@ import filter from 'lodash/filter' import isEmpty from 'lodash/isEmpty' import './with_load_more.scss' -const withLoadMore = (Component, fetch, select, entriesPropName = 'entries') => { - const originalProps = Component.props || [] +const withLoadMore = ({ fetch, select, entriesPropName = 'entries' }) => (WrappedComponent) => { + const originalProps = WrappedComponent.props || [] const props = filter(originalProps, v => v !== 'entries') return Vue.component('withLoadMore', { @@ -18,7 +18,7 @@ const withLoadMore = (Component, fetch, select, entriesPropName = 'entries') => } return ( <div class="with-load-more"> - <Component {...props} /> + <WrappedComponent {...props} /> <div class="with-load-more-footer"> {this.error && <a onClick={this.fetchEntries} class="alert error">{this.$t('general.generic_error')}</a>} {!this.error && this.loading && <i class="icon-spin3 animate-spin"/>} |
