How to use javaScript Promises in lightning components

how to use javaScript promises in lightning components,Using JavaScript Promises in lightning components, promise in lwc, lwc promise, lightning component promise real time example usage

How to use javaScript Promises in lightning components:- In salesforce lightning component if you want to set attribute values immediately after a apex server call you can use the javascript promise.

Promises can simplify code that handles the success or failure of asynchronous calls, or code that chains together multiple asynchronous calls.

In this following example, i am making a server call using promise to get dropdown values once call is success then i chained a one more promise to set default value for the dropdown from backend.

 




For a great introduction to promises, see https://developers.google.com/web/fundamentals/getting-started/primers/promises.

Be the first to comment

Leave a Reply

Your email address will not be published.


*