Lightning Data Service (LDS) is an intermediate layer between Lightning Components (both LWC and Aura) and User Interface API of Salesforce, it runs on the browser. The records loaded in Lightning Data Service are cached on the browser and shared across all components on the page. If there are multiple components using the same record, the record is loaded once and shared with all components, this improves the platform performance as the record is not loaded multiple times.
What are the benefits of Lightning Data Service(LDS)?
- Improved performance.
- Caches data on the client-side, so server overhead is reduced.
- Data is consistent between all components that are using LDS.
- If data is changed at one place on the page, it will be refreshed in all other components on the page.
- It does not cost against API usage calls.
- Automatically refreshes the data in the cache when it is outdated.
- It honors the CRUD permission for the records and objects.
How Lightning Data Service works?
How we can use Lightning Data Service in Lightning Web Components?
In lightning web components you can use LDS in two different ways
-
Standard Lightning web components
lightning-record-edit-form
,lightning-record-form
, andlightning-record-view-form
. -- Lightning record forms. -
Lightning UI APIs, like
uiRecordApi
,uiObjectApi
which contains wired adapters functions.
LWC Series
- Lightning Web Components Folder Structure
- Lightning data service with LWC
No comments :
Post a Comment
Hi there, comments on this site are moderated, you might need to wait until your comment is published. Spam and promotions will be deleted. Sorry for the inconvenience but we have moderated the comments for the safety of this website users. If you have any concern, or if you are not able to comment for some reason, email us at rahul@forcetrails.com