UNPKG

react-form-with-constraints

Version:
11 lines (10 loc) 346 B
import { Children } from 'react'; export function deepForEach(children, fn) { Children.forEach(children, child => { const element = child; if (element.props && element.props.children && typeof element.props.children === 'object') { deepForEach(element.props.children, fn); } fn(element); }); }