Skip to content

Suspense documentation incorrectly conflates componentDidMount with "component has rendered on the screen" #2700

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
craigkovatch opened this issue Jan 22, 2020 · 0 comments

Comments

@craigkovatch
Copy link
Contributor

craigkovatch commented Jan 22, 2020

In the "Approach 1" section:

We call this approach “fetch-on-render” because it doesn’t start fetching until after the component has rendered on the screen. This leads to a problem known as a “waterfall”.

However, @gaearon has previously clarified out that componentDidMount only guarantees that the React tree has been mounted onto a DOM node, not that that DOM node is attached to the document/visible on screen: facebook/react#9117 (comment)

The componentDidMount would fire because the mounting has happened. However, as you can see, the div I’m mounting into is not actually part of the page’s DOM. Therefore, the component’s DOM node is also not in the document even though it has mounted into its container.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant