It's common practice in React to add keys to elements that are being iterated.
After looking carefully at the docs for forwardRef, and running into an issue with a key not being set, it appears that forwardRef returns an iterator, and requires a unique key is set on each element.
It would be great to have the docs for forwardRef reflect this requirement, and note anything unique e.g. common patterns to use when iterating to produce childComponents, which utilize forwardRef.
It's common practice in
Reactto add keys to elements that are being iterated.After looking carefully at the docs for forwardRef, and running into an issue with a
keynot being set, it appears thatforwardRefreturns aniterator, and requires a uniquekeyis set on each element.It would be great to have the docs for
forwardRefreflect this requirement, and note anything unique e.g. common patterns to use when iterating to producechildComponents, which utilizeforwardRef.