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?
Suggested Answer: A
Get Premium Plat-Dev-201 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
The@AuraEnabled(cacheable=true)annotation makes an Apex method available to Lightning Web Components and allows it to be wired to a property while enabling client-side caching for improved performance.
Incorrect Options:
B, C:@RemoteActionis not used for Lightning Web Components.
D:@AuraEnabledwithoutcacheable=truecannot be wired.
9 comments · newest first
TA
Tasia
2 days ago
I thought @RemoteAction could work too, but maybe not?
DE
Desmond
7 days ago
@AuraEnabled is definitely the right choice here.
ME
Melissa
12 days ago
Wait, is @RemoteAction not valid for LWC?
DE
Delfina
17 days ago
Totally agree, @AuraEnabled is the way to go.
CA
Carmen
23 days ago
Gotta use @AuraEnabled for that!
GE
Gerardo
28 days ago
I feel like @AuraEnabled is the answer, but I can't recall if it has to be cacheable for it to work with properties.
MA
Marya
1 month ago
I’m a bit confused between @AuraEnabled and @RemoteAction. Do both work for Lightning components?
YU
Yuriko
1 month ago
I remember practicing a question about this, and I think @AuraEnabled is definitely the right choice.
PA
Page
1 month ago
I think it's @AuraEnabled, but I'm not sure if it needs any parameters like cacheable.