Take action when entire React dom tree has loaded

Take action when entire React dom tree has loaded

How do I fire an action when the entire React DOM tree has loaded? As in knowing when siblings of a child have loaded. I believe&nbsp;<code>componentDidUpdate</code>&nbsp;of a container component is only supposed to fire when it's fully rendered (as in its child components have rendered), but I'm finding that is not the case.

How do I fire an action when the entire React DOM tree has loaded? As in knowing when siblings of a child have loaded. I believe componentDidUpdate of a container component is only supposed to fire when it's fully rendered (as in its child components have rendered), but I'm finding that is not the case.

For example:

class ParentContainer extends Component {

componentDidUpdate() { // all of the children should be rendered by now? const { section } = this.props const scrollToEl = document.getElementById(section) if (scrollToEl) { scrollToEl.scrollIntoView({block: 'start', behavior: 'smooth'}) } }

render() { return ( <div> <SiblingWithChildren1 /> <SiblingWithChildren2 /> <Child1> <Child2> array.map(comp => <Section id={comp.id} /> ) </Child2> </Child1> </div> ) } }

In this case the document begins to scroll to the element that might match a Section id.

But, the scroll comes up short because everything hasn't fully rendered in the DOM yet, even if only by milliseconds. If the SiblingWithChildren components have not fully loaded it throws off the height of the document.

Using a setTimeout seems brittle.

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

ReactJS vs Angular vs Vue: Best Javascript Framework For Your Project

ReactJS vs Angular vs Vue: Best Javascript Framework For Your Project. This video covers the key differences between ReactJS, Angular and Vue with respect to the following: Use case, Performance, Data binding, Scripting language, Testing, Community support, Growth curve

What is JavaScript – All You Need To Know About JavaScript

In this article on what is JavaScript, we will learn the basic concepts of JavaScript.

JavaScript Tutorial: if-else Statement in JavaScript

This JavaScript tutorial is a step by step guide on JavaScript If Else Statements. Learn how to use If Else in javascript and also JavaScript If Else Statements. if-else Statement in JavaScript. JavaScript's conditional statements: if; if-else; nested-if; if-else-if. These statements allow you to control the flow of your program's execution based upon conditions known only during run time.