for:each in lwc js 1

for:each in lwc js

import { LightningElement, wire } from 'lwc';
import getAccountList from '@salesforce/apex/AccountHelper.getAccountList';
export default class AccountListForEachLWC extends LightningElement {
    @wire(getAccountList) accounts;
}

Here is what the above code is Doing:
1. The @wire decorator is used to call the Apex method getAccountList.
2. The getAccountList method returns a list of Account records.
3. The accounts variable is used to store the list of Account records.

Now, let’s display the list of Account records in the HTML template.

Similar Posts