Salesforce Platform Developer I (legacy) — Question 155
A developer created a child Lightning web component nested inside a parent Lightning web component. The parent component needs to pass a string value to the child component.
In which two ways can this be accomplished? (Choose two.)
Answer options
- A. The parent component can use a custom event to pass the data to the child component.
- B. The parent component can invoke a method in the child component.
- C. The parent component can use a public property to pass the data to the child component.
- D. The parent component can use the Apex controller class to send data to the child component.
Correct answer: B, C
Explanation
The correct methods for passing data from a parent to a child Lightning web component are through invoking a method in the child component (B) and using a public property (C). Custom events (A) are used for sending data from child to parent, while Apex (D) is not directly applicable for passing data between components.