journey2salesforce

How to use Salesforce Resources in Lightning Web Component?

Salesforce ResourceSyntax to use
Static Resourceimport sampleResource from '@salesforce/resourceUrl/resourceReference';

Only, we need to enter Static Resource Name in the place of resourceReference and then refer to the property in JS file.If there is a specific namespace in your org, please put the Static Resource Name with the namespace i.e., namespace__StaticResourceName.
Custom Labelimport labelName from '@salesforce/label/labelReference';


Only, we need to enter Custom Label Name with namespace in the place of labelReference and then refer to the property in JS file. If there is no specific namespace in your org, please put the Custom Label Name with default namespace c.
Current User Idimport userId from '@salesforce/user/Id';
SVG ResourceWe can directly write down the SVG in template of the HTML file using tag.
You can also import the SVG from static resource.

1,479 total views, 3 views today

Rating: 5.0/5. From 1 vote.
Please wait...

You may also like...