reactjs / reactjs/react.dev

Missing documentation

Open
#3,517 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
11.8k
Forks
7.9k
Avg merge
1d 11h
Merged PRs (30d)
11

Description

I stumbled onto something that works but is not documented and I'd like to understand if it should be avoided.

The setup: Non react application renders various react components in few places.

I've noticed couple of components that do the following:

function Foo(props){
    return <div>
        Some content
        <div id="placeholder"></div>
    </div>
}
ReactDOM.render(<Foo/>, domRef)

Somewhere else in the application ReactDOM.render(<Bar/>, document.getElementById("placeholder")). The "placeholder" being the dom element rendered by the <Foo /> component.

I couldn't find anything in the React docs and Stackoverflow describing how/if this should work. Any light on the subject would be much appreciated.

I have also opened a this: https://stackoverflow.com/questions/66134211/reactdom-render-one-react-component-inside-the-render-tree-of-another

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 ReactDOM.render examples described in the issue and compare them with the existing React documentation. Determine whether rendering into a DOM element produced by another component is supported or should be avoided, then document the guidance and verify that the page addresses the nested-rendering case raised here.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation, frontend
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.