Best Practices

When it comes to best practices for using the Radical API, there are a few things you should keep in mind. Here are some best practices to follow:


Update the visibility of an element

When it comes to updating the visibility of an element, you should use the rad.updateElementStyles method. This method is more efficient and easier to use than updating the style attribute directly. The problem with updating the style attribute directly is that for certain elements (like Textbox), you also need to call the updateShrink() method to make the Textbox visible. rad.updateElementStyles handles this for you.

Code Example

    // bad
    const el = rad.getElementById('a1');
    el.domNode.style.display = 'block';

    // :+1: proper way
    rad.updateElementStyles('a1', { visible: true });

Was this page helpful?