+ Start a Discussion
inbox outbox 7inbox outbox 7 

Difference between fetch API and its method fetch() and directly making a callout from the apex controller in LWC?

We can make a callout by adding CSP site, and use fetch() in the js file. 
We can also make a HTTP request from the apex controller.
I can only think of one thing:
If we are just making a GET request to show some data on LWC, we use fetch api.
If we are doing a process integration, where the response has to updated in to the salesforce and the component has to be re-rendered we use apex controller class. Is that right?
Can someone explain the difference?
VinayVinay (Salesforce Developers) 
We can use fetch API to make a callout from LWC and process the response.

Example:
https://blog.salesforcecasts.com/using-fetch-api-in-lwc/

Please mark as Best Answer if above information was helpful.

Thanks,