Skip to main content

Posts

Showing posts with the label get method in LWC

Why do we need getter in LWC?

 LWC template/component does not allow expression or any manipulation or array expression. To solve this problem "Getter" is solution. It atomically bind data from Java scripts to template. Error =  Invalid expression {employee[0]} - LWC1038: Template expression doesn't allow computed property accesslwc  <div class="slds-m-around_medium">            {employee[0]} <p> The sum of {num1} and {num2} is {num1+num2}  </div> Component code < template >     < lightning-card title = "Getters in LWC" >         < div class = "slds-m-around_medium" >             {firstEmployee}             < p > The sum of {num1} and {num2} is {sumResults} </ p >         </ div >     </ lightning-card > </ template > J ava script code When employee gets updated then automatical...