Repository URL to install this package:
|
Version:
2.7.17 ▾
|
import React from 'react'
import { isArray } from 'exotic'
import { defaultRenderShoppingListItem } from './renderProps'
import { ShoppingListProps } from './typings'
class ShoppingList extends React.Component<ShoppingListProps> {
static defaultProps = {
className: '',
renderShoppingListItem: defaultRenderShoppingListItem,
}
render() {
const {
shoppingList,
renderShoppingListItem,
...remainingProps
} = this.props
const view =
isArray(shoppingList) &&
shoppingList.map((item, index) =>
renderShoppingListItem({ item, index, ...remainingProps })
)
return view
}
}
export { ShoppingList }
export default ShoppingList