react.dev icon indicating copy to clipboard operation
react.dev copied to clipboard

Mention that `Component.render` could return iterator

Open askoretskiy opened this issue 7 years ago • 5 comments

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

askoretskiy avatar Nov 14 '17 10:11 askoretskiy

Hi @askoretskiy. Would you like to contribute a PR for this?

bvaughn avatar Nov 14 '17 21:11 bvaughn

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.

gaearon avatar Nov 14 '17 21:11 gaearon

@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?

brettdewoody avatar Dec 14 '19 12:12 brettdewoody

@bvaughn I would love to work on this issue. Please assign it to me.

varunKT001 avatar Oct 29 '22 11:10 varunKT001

@askoretskiy Please assign this issue to me

LaAltagracia avatar Mar 15 '23 22:03 LaAltagracia