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_list | |
| parent | 8f608e060c813dc6d9aeeb548beca971ce9b74bd (diff) | |
Use hoc definitions to be factor of factory
Diffstat (limited to 'src/hocs/with_list')
| -rw-r--r-- | src/hocs/with_list/with_list.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/hocs/with_list/with_list.js b/src/hocs/with_list/with_list.js index 5ec37a2b..c31cdcb1 100644 --- a/src/hocs/with_list/with_list.js +++ b/src/hocs/with_list/with_list.js @@ -4,8 +4,8 @@ import map from 'lodash/map' const defaultEntryPropsGetter = entry => ({ entry }) const defaultKeyGetter = entry => entry.id -const withList = (Component, getEntryProps = defaultEntryPropsGetter, getKey = defaultKeyGetter) => { - return Vue.component('withList', { +const withList = ({ getEntryProps = defaultEntryPropsGetter, getKey = defaultKeyGetter }) => (ItemComponent) => ( + Vue.component('withList', { render (createElement) { return ( <div class="with-list"> @@ -18,13 +18,13 @@ const withList = (Component, getEntryProps = defaultEntryPropsGetter, getKey = d }, on: this.$props.entryListeners } - return <Component {...props} /> + return <ItemComponent {...props} /> })} </div> ) }, props: ['entries', 'entryProps', 'entryListeners'] }) -} +) export default withList |
