Modal Class — react Architecture
Architecture documentation for the Modal class in refs-destruction-test.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD a3f5e28d_9307_c103_e974_f5c6d2b23e87["Modal"] 618c664a_1cdc_4b70_8f87_47a55e9fb96e["refs-destruction-test.js"] a3f5e28d_9307_c103_e974_f5c6d2b23e87 -->|defined in| 618c664a_1cdc_4b70_8f87_47a55e9fb96e 9759083b_646b_0a6b_7665_ceed7f1557b7["componentDidMount()"] a3f5e28d_9307_c103_e974_f5c6d2b23e87 -->|method| 9759083b_646b_0a6b_7665_ceed7f1557b7 45939ff8_28e9_0033_ad43_9fbd295243d4["componentDidUpdate()"] a3f5e28d_9307_c103_e974_f5c6d2b23e87 -->|method| 45939ff8_28e9_0033_ad43_9fbd295243d4 5e08f3a7_e412_be40_ac7c_ba1e39923008["componentWillUnmount()"] a3f5e28d_9307_c103_e974_f5c6d2b23e87 -->|method| 5e08f3a7_e412_be40_ac7c_ba1e39923008 56701cbf_1350_ab77_fb27_015237c07b84["render()"] a3f5e28d_9307_c103_e974_f5c6d2b23e87 -->|method| 56701cbf_1350_ab77_fb27_015237c07b84
Relationship Graph
Source Code
packages/react-dom/src/__tests__/refs-destruction-test.js lines 123–153
class Modal extends React.Component {
componentDidMount() {
this.div = document.createElement('div');
nestedRoot = ReactDOMClient.createRoot(this.div);
document.body.appendChild(this.div);
this.componentDidUpdate();
}
componentDidUpdate() {
setTimeout(() => {
ReactDOM.flushSync(() => {
nestedRoot.render(<div>{this.props.children}</div>);
});
}, 0);
}
componentWillUnmount() {
const self = this;
// some async animation
setTimeout(function () {
expect(function () {
nestedRoot.unmount();
}).not.toThrow();
document.body.removeChild(self.div);
}, 0);
}
render() {
return null;
}
}
Source
Frequently Asked Questions
What is the Modal class?
Modal is a class in the react codebase, defined in packages/react-dom/src/__tests__/refs-destruction-test.js.
Where is Modal defined?
Modal is defined in packages/react-dom/src/__tests__/refs-destruction-test.js at line 123.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free