function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mohammad AnzarMohammad Anzar 

Why @AuraEnabled methods are static ?

Why @AuraEnabled methods are static ? 
Dev_AryaDev_Arya
hi Anzar,

the AuraEnabled methods are required to provide server side access to a controller and for salesforce, all server side controllers need to be static so that all the instances of the components share one static controller.  If you are wondereing why is it so? The answer is, thats make the Lightning components modular, that being said different lightning components can work independently. Thats my understanding. 
sfdcMonkey.comsfdcMonkey.com
because lightning framework is stateful client(javaScript) and stateless server(apex) This structure allows the client to call the server only when absolutely necessary. With fewer calls to the server, your apps are more responsive and efficient. due to stateless server feature it can only access static methods with @AuraEnabled

Thanks let me know if it helps you
http://sfdcmonkey.com