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

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.








Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow