top of page

Conditional rendering in Lightning Web Component (LWC)

Like Aura Components <Aura:if>, we have <template if:true> and <template if:false>in Lightning web component.

The if:true|false={property} directive binds data to the template and removes and inserts DOM elements based on whether the data has true or false value.

Example -

In javascript, you don't have to modify DOM and just have to change the value of property.

3,748 views0 comments


bottom of page