react.dev
react.dev copied to clipboard
Mention that `Component.render` could return iterator
According to the discussion here https://github.com/facebook/react/issues/11502 it is legal to return iterators from Component.render
. But it is not mentioned in the document.
Moreover -- it would work only in production mode, not in development. It should me mentioned that to make it work in both environments -- you should use iterable, rather than iterator (see this Seq
approach from the Reach issue).
I suggest to place it around https://reactjs.org/docs/react-component.html#fragments
Hi @askoretskiy. Would you like to contribute a PR for this?
it would work only in production mode, not in development.
FWIW I don't think this is the right way to describe.
It would work until the first enumeration. Yes, it happens early in development and late in production. But this doesn't mean the feature "works" in production. On the next update, even in production, the interator would be done.
@askoretskiy
Should we add a new bullet point to the list for iterables
, with a comment to not use iterators
.
Or, a <blockquote>
with Note warning not to use iterators
at the end of the list?
@bvaughn I would love to work on this issue. Please assign it to me.
@askoretskiy Please assign this issue to me