aboutsummaryrefslogtreecommitdiff
path: root/src/hocs/with_load_more
diff options
context:
space:
mode:
authortaehoon <th.dev91@gmail.com>2019-02-13 23:25:21 -0500
committertaehoon <th.dev91@gmail.com>2019-02-20 13:30:31 -0500
commit6d4d705c51a3d39e4de22a3320cfa61ef63a0066 (patch)
tree153f393d4443e52e197176b33039a639976b7bbc /src/hocs/with_load_more
parent339373b495f5f30833268c01d1fe958e2ee99a7f (diff)
Rename some options and add comments to HOCs
Diffstat (limited to 'src/hocs/with_load_more')
-rw-r--r--src/hocs/with_load_more/with_load_more.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/hocs/with_load_more/with_load_more.js b/src/hocs/with_load_more/with_load_more.js
index 28c741e3..459e026c 100644
--- a/src/hocs/with_load_more/with_load_more.js
+++ b/src/hocs/with_load_more/with_load_more.js
@@ -3,7 +3,11 @@ import filter from 'lodash/filter'
import isEmpty from 'lodash/isEmpty'
import './with_load_more.scss'
-const withLoadMore = ({ fetch, select, entriesPropName = 'entries' }) => (WrappedComponent) => {
+const withLoadMore = ({
+ fetch, // function to fetch entries and return a promise
+ select, // function to select data from store
+ childPropName = 'entries' // name of the prop to be passed into the wrapped component
+}) => (WrappedComponent) => {
const originalProps = WrappedComponent.props || []
const props = filter(originalProps, v => v !== 'entries')
@@ -12,7 +16,7 @@ const withLoadMore = ({ fetch, select, entriesPropName = 'entries' }) => (Wrappe
const props = {
props: {
...this.$props,
- [entriesPropName]: this.entries
+ [childPropName]: this.entries
},
on: this.$listeners
}