Modifying DOM Elements Managed by External Libraries

You can use different libraries, such as a charting library, to create and manage DOM elements. You don’t have to modify these DOM elements within the render event handler or a renderer because they are managed by the external library.

A render event handler or a renderer are used only to customize DOM elements created and managed by the Lightning Component framework.

To use external libraries, use <ltng:require>. The afterScriptsLoaded attribute enables you to interact with the DOM after your libraries have loaded and the DOM is ready. <ltng:require> tag orchestrates the loading of your library of choice with the rendering cycle of the Lightning Component framework to ensure that everything works in concert.