componentDidMount method
ReactJS lifecycle method that is invoked once, only on the client (not on the server), immediately after the initial rendering occurs.
At this point in the lifecycle, you can access any refs to the children of the root node.
The componentDidMount method of child Component
s is invoked before that of parent Component
.
See: reactjs.org/docs/react-component.html#mounting-componentdidmount
Implementation
@mustCallSuper
@override
void componentDidMount() {
_checkForDetachedMount();
if (props.quickMount!) {
assert(props.onInitialize == null || ValidationUtil.warn(
'props.onInitialize will not be called when props.quickMount is true.',
this
));
// [1] Initialize/reset the sensor in the next animation frame after mount
// so that resulting layouts don't happen synchronously, and are better dispersed.
//
// [2] Ignore the first `2` scroll events triggered by resetting the scroll positions
// of the expand and collapse sensors.
//
// [3] Don't access the dimensions of the sensor to prevent unnecessary layouts.
requestAnimationFrame(() { // [1]
_scrollEventsToIgnore = 2; // [2]
_reset(updateLastDimensions: false); // [3]
});
} else {
_reset();
if (props.onInitialize != null) {
var event = ResizeSensorEvent(_lastWidth, _lastHeight, 0, 0);
props.onInitialize!(event);
}
}
}