spx.render
The spx.render method can be leveraged to perform targeted rendering insertions in the DOM. It works similar to spx-append and spx-prepend but provides programmatic control over the operation. The method accepts either a function callback that expects a configuration return value.
::: note Use this method with mindfulness. Expensive operations was cause bottlenecks. ::
Example
Below is an example of the method works. You should also take a look at the SPX Infinite Scrolling example which uses the spx.render for infinite pagination.
Page 1
Let’s assume you have click event listener setup for #next-page button. When a user clicks the button then the above example snippet fires and a fetch begins for Page 2.
Page 2
On this page we have 2 additional boxers in a list. Based on the method code example above, we will be appending the childNodes to the ul list using the id #foo on Page 1.