Posts

Showing posts with the label child

Salesforce Fact #810 | Call parent component method in child LWC

Image
In order to call parent component's method in child LWC component, we can pass the method as a public property from parent to child and then invoke the same in child component. Reference:  https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000C5ddmSAB Attached are the screenshots.

Salesforce Fact #594 | LWC: pass value from parent to child conditionally

Image
Suppose we have a scenario in LWC where we want to pass an attribute value from parent to child component only when it has some value in parent. If it is null, it will keep the immediate previous value in child. We can implement the same using some condition check. In this example, we have an input in parent component and the same value is passed to child. But if it is blank, that value is not passed to child and the immediate previous one is kept. Attached are the screenshots.