MCPcopy
hub / github.com/react-grid-layout/react-grid-layout / childrenEqual

Function childrenEqual

src/react/components/GridLayout.tsx:212–225  ·  view source on GitHub ↗

* Compare children arrays for equality

(a: React.ReactNode, b: React.ReactNode)

Source from the content-addressed store, hash-verified

210 * Compare children arrays for equality
211 */
212function childrenEqual(a: React.ReactNode, b: React.ReactNode): boolean {
213 const aArr = React.Children.toArray(a);
214 const bArr = React.Children.toArray(b);
215
216 if (aArr.length !== bArr.length) return false;
217
218 for (let i = 0; i < aArr.length; i++) {
219 const aChild = aArr[i] as ReactElement;
220 const bChild = bArr[i] as ReactElement;
221 if (aChild?.key !== bChild?.key) return false;
222 }
223
224 return true;
225}
226
227/**
228 * Synchronize layout with children

Callers 1

GridLayoutFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…