0

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.

2 Answers2

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.

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