I am writing a react web application that dynamically renders more data based on scroll position of a window frame to improve initial loading time. My problem is that I need to know when the additional data is completely done updating so i can call an external function that keeps track of the scroll position of DOM elements that have been newly rendered
the external function pseudo code can be seen below
this.renderAdditionalData(child); //Once the child has actually displayed all of the additional data(DOM elements updated) new Promise((res, rej) =>{ child.mapNewLines(res);//this method calls res after all the processing has finished }).then(() =>{this.doSomethingWithNewData(foo);}); How would I go about starting this promise after the data has been updated on the screen because mapNewLines uses the newly rendered data's DOM properties