Skip to content

Don't render to document.body directly #7

Closed
@MartinMajewski

Description

@MartinMajewski

Hi,

thank you very much for your minimal boilerplate code. Finally a really minimal example! 👍

One thing that should be modified though, is the react DOM rendering.
Rendering with

ReactDOM.render(<Main />, document.body);

results in a chromium warning

warning.js:36 Warning: render(): Rendering components directly into document.body is discouraged, since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try rendering into a container element created for your app.

The better solution:

Change the rendering call to

ReactDOM.render(<Main />, document.getElementById('react_container'));

and add the following between the tags of the index.html file:

<div id="react_container"></div>

Warning will then go away and the example stays minimal :-)

Best wishes,
Martin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions