Finding Elements
There are scenarios in which your Actions may need to obtain a reference (address) to a specific element within your Loopic Composition. This can be particularly useful when implementing middleware logic that involves modifying an element's properties or accessing its underlying DOM node reference.
Each element within Loopic is equipped with a unique key property, serving as the element's "ID" within the composition. To ensure composition-wide uniqueness, these keys must be distinct.
Within the Actions framework, you can retrieve a reference to a designated element by utilizing the findElementByKey
method. This method is conveniently accessible through the Composition object. When invoked, findElementByKey
undertakes a comprehensive search across all elements present within the composition, including those within nested compositions. The objective is to locate and return the specific element identified by the provided key.
const elementObject = this.findElementByKey("_title");