UNPKG

779 BTypeScriptView Raw
1import React from 'react';
2/**
3 * Iterates through children that are typically specified as `props.children`,
4 * but only maps over children that are "valid elements".
5 *
6 * The mapFunction provided index will be normalised to the components mapped,
7 * so an invalid component would not increase the index.
8 *
9 */
10declare function map<P = any>(children: any, func: (el: React.ReactElement<P>, index: number) => any): any;
11/**
12 * Iterates through children that are "valid elements".
13 *
14 * The provided forEachFunc(child, index) will be called for each
15 * leaf child with the index reflecting the position relative to "valid components".
16 */
17declare function forEach<P = any>(children: any, func: (el: React.ReactElement<P>, index: number) => void): void;
18export { map, forEach };