import React from 'react' ; import { ListModel } from './useListModel' ; export function useRenderItems < T > ( model , children ) { const items = React . useMemo ( ( ) => { return typeof children === 'function' ? model . state . items . map ( item => React . cloneElement ( children ( item ) , { key : model . getId ( item ) } ) ) : null ; } , [ model . state . items ] ) ; return items || children ; }