Hi
I was curious to understand why you implemented this with a javascript while loop and a promise, where you can also use the ReactJS event componentDidMount on the specific OutSystems widget and an event handler.
https://www.codingame.com/playgrounds/8747/react-lifecycle-methods-render-and-componentdidmount
Regards,
Daniel
I agree! In our project we use a lot those React LifeCycle methods to control the rendering of the elements.
Hi Daniël Kuhlmann,
Thank you very much for the alternative solution! That's a great one, with much less complexity.
Just to give some context, we created this component, because we needed to react to the creation of an element from a "sibling" block, so we didn't have access to the Events of the element that we wanted to listen to.
In our case, we wanted to see if the fifth line of a list was present on the page in order to append a banner after it. You can find bellow how we used the Component.
I guess we could have found a workaround with your solution, however, it would be complex as well the process of sending the Event to the listening block, since it's not the parent. We have found was in the past to send events like this, but they always require some javascript.
Once again, that was a really cool insight!
Thanks for sharing it with us, and with the people looking for such a solution, like we were when we built this component. :)