Salesforce Platform Developer I (legacy) — Question 191
Which annotation should a developer use on an Apex method to make it available to be wired to a property in a Lightning web component?
Answer options
- A. @RemoteAction(cacheable=true)
- B. @AuraEnabled
- C. @RemoteAction
- D. @AuraEnabled(cacheable=true)
Correct answer: D
Explanation
The correct answer is D, as the @AuraEnabled annotation with the cacheable=true parameter allows the method to be called from Lightning web components and supports caching. Option B only enables the method but does not specify caching, while options A and C are not applicable for Lightning web components.