Use the Wire Service to Get Data

  • @wire in a component's JavaScript class used for LDS wire adapter. 
  • Data provisioned by wire service is always a new copy and cannot be modified directly. We need to make a local copy to make changes to it.(Immutable) 
  • wire service is reactive. If a reactive variable changes, the wire service provisions new data.  
  • Each record provisioned is a newer version of the value that precedes it. 
  • The LDS wire adapters are built on User Interface API resources and live in the lightning/ui*Api modules. 
  • Each wire adapter provides different Salesforce data and metadata, from individual records and lists of records, to object and layout schema. 

Wire Service Syntax 

import { adapterld } from 'adapterModuLe' ;  re(adapterld, adapterConfig)  propertyOrFuncti on ;

 

Get Record Data 

  • As discussed above, importing module "lightning/uiRecordApi" to get record data is primary 
  • Generally we give "getRecord", as the adaptorId. 
  • As part of adaptor config we pass fields so that wire adaptor know what are the fields to retrieve. 
  •  

 


Read more on TOI
More from ChatGPT
null

No comments:

Powered by Blogger.