For my application, I need to display some children and then measure the resulting div. In pseudocode, it looks something like this:
function getDims(child) { var testEl = document.getElementById('test-el'); ReactDOM.render(child, testEl); var dims = testEl.getBoundingClientRect(); ReactDOM.unmountComponentAtNode(testEl); return dims; }
Unfortunately, according to the documentation, ReactDOM.render may become asynchronous in the future. Is there a future-proof way to force synchronous rendering so that the above function works?
source share