nerdexam
SalesforceSalesforce

PDI · Question #220

PDI Question #220: Real Exam Question with Answer & Explanation

The correct answer is C: @AureEnabled (cacheable=true). To enable an Apex method for wiring in a Lightning Web Component, it must be annotated with @AuraEnabled and specifically (cacheable=true) if the data is read-only and can be cached client-side.

Submitted by minji_kr· Apr 18, 2026User Interface

Question

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?

Options

  • A@RemoteAction
  • B@AureEnabled
  • C@AureEnabled (cacheable=true)
  • D@RemoteAction(|cacheable=true)

Explanation

To enable an Apex method for wiring in a Lightning Web Component, it must be annotated with @AuraEnabled and specifically (cacheable=true) if the data is read-only and can be cached client-side.

Common mistakes.

  • A. @RemoteAction is used for exposing Apex methods to Visualforce pages for JavaScript remoting, not for wiring to properties in Lightning Web Components.
  • B. @AuraEnabled without (cacheable=true) exposes the method but does not enable client-side caching, which is a key performance feature for wired properties that retrieve read-only data.
  • D. The syntax @RemoteAction(|cacheable=true) is incorrect; cacheable=true is an attribute of @AuraEnabled, and @RemoteAction is for Visualforce remoting, not LWCs.

Concept tested. Apex method annotations for Lightning Web Components (LWC) wiring

Reference. https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/apex_api_methods.htm

Topics

#Lightning Web Components#Apex Annotations#@wire service#AuraEnabled

Community Discussion

No community discussion yet for this question.

Full PDI PracticeBrowse All PDI Questions