MCPcopy Index your code
hub / github.com/react-bootstrap/react-bootstrap / forEach

Function forEach

src/ElementChildren.tsx:28–36  ·  view source on GitHub ↗

* Iterates through children that are "valid elements". * * The provided forEachFunc(child, index) will be called for each * leaf child with the index reflecting the position relative to "valid components".

(
  children,
  func: (el: React.ReactElement<P>, index: number) => void,
)

Source from the content-addressed store, hash-verified

26 * leaf child with the index reflecting the position relative to "valid components".
27 */
28function forEach<P = any>(
29 children,
30 func: (el: React.ReactElement<P>, index: number) => void,
31) {
32 let index = 0;
33 React.Children.forEach(children, (child) => {
34 if (React.isValidElement<P>(child)) func(child, index++);
35 });
36}
37
38/**
39 * Finds whether a component's `children` prop includes a React element of the

Callers 2

getDefaultActiveKeyFunction · 0.90
Carousel.tsxFile · 0.90

Calls 1

funcFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…