react-form-with-constraints
Version:
Simple form validation for React
11 lines (10 loc) • 346 B
JavaScript
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);
});
}