Set class
Set class toggles a class based on a condition.
If the condition evaluates to true
, the specified class is added to the target element.
If the condition evaluates to false
, the class won't be added, or if the element contains the class, it will be removed.
In the example on the image above, we're checking whether the r.get_user
request is currently being executed. If it is, we're adding the is-loading
class to the target element.
For more info, check this article on truthy and falsy values.