import React from 'react' ; param { string } name param { element } children param { object } props example export function getChild ( name , children , props = { } ) { return React . Children . map ( children , ( child , index ) => { if ( React . isValidElement ( child ) && ( child . type . displayName === name || child . type . name === name ) ) { props . index = index ; return React . cloneElement ( child , props ) ; } return null ; } ) ; } export function excludeChild ( names , children ) { return React . Children . map ( children , ( child ) => { if ( React . isValidElement ( child ) && names . includes ( child . type . displayName ) ) { return null ; } return child ; } ) ; }