top of page

Conditional rendering in Lightning Web Component (LWC)

Writer: Saurabh SinghSaurabh Singh

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.


Comments


Subscribe to SFDC BLOGS

©2019 by SFDC Blogs.

bottom of page