'How to detect when DOM is rendered by React on external JavaScript
Is there a way to detect DOM is rendered on a React based page by external JavaScript? I would like to access/get DOM elements in an external JavaScript file after DOM is rendered by React.
My idea is using custom event and use it in EventListener but would like to know if there is another way. Thanks!
// React
componentDidMount() {
document.dispatchEvent('didmount')
}
// external JavaScript
document.addEventListener('didmount', () => {...})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
