reactjs / reactjs/react.dev

Mention that `Component.render` could return iterator

Open Beginner friendly
#286 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

difficulty: medium good first issue type: documentation
Dominant language
JavaScript
Stars
11.8k
Forks
7.9k
Avg merge
1d 11h
Merged PRs (30d)
11

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the React Component documentation at the linked react-component.html#fragments section, then read the linked React issue and its Seq discussion for the iterator and iterable behavior. Update the documentation to mention that Component.render may return an iterator, explain the production-only limitation, and recommend an iterable for consistent behavior in both environments.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.