I have a static method in a class from which I am getting a string which is in the form of link. Now when I am trying to pull the same data in the LWC, I am getting the data as undefined. Can anyone please explain me if I need to perform any conversion in the logic or I have to add extra logic in JS.
Asked
Active
Viewed 1,375 times
0
-
1Can you check if the method has AuraEnabled annotation? Also please add snippets of your class and js – Ashwini Raman Jul 16 '21 at 23:12
2 Answers
1
Your Apex method should be annotated with @AuraEnabled(cacheable=true)
to be used with LWC.
Then you can simply import your method in LWC using either @wire
or imperative Apex.
Checkout the standard documentation here
Please add your code here if you're still having issues.

Parth Mewara
- 11
- 3
0
If you are using Apex, your static method must have @AuraEnabled(cacheable=true)
if you wan't to be able to store the data in lwc.

Dylan Cadd
- 20
- 3