You need to sign in to do that
Don't have an account?
kaka kumar
Why don't we need viewstate in lightning
Hi all ,
I am confused about veiwstate thing in lightnign and why don't we need that in lightning.how do lightning maintain state of variables in page?
I am confused about veiwstate thing in lightnign and why don't we need that in lightning.how do lightning maintain state of variables in page?
i hope it would be help to you ,please make it best answer if it helpfull for you.
thanks
However, just to add to the above; I believe the lack of a viewstate here is due to the compiler needed for a LC being different to the compiler needed for VF pages.
If you think of it this way:
When a VF page is rendered and outputs data it is compiled server side and the HTML is then pushed to the client side and displayed to the user, therefore utilises a LOT of resource to try and compile a page, for example, that has 1,000,000+ rows of data along with styling, etc...
Whereas, if you are using a JS framework, it will utilise the client side resources to actually compile and output the data that is needed... if you were to load the 1,000,000+ rows of data in a LC; it will output the rows, but it will take a while to load and will, potentially, crash the browser that is trying to render the page due to the resources being drained from the client side as opposed to the server side.
VF : Page and Extension/Custom controller is tightly bound , All the Data majorly used in VF page is defined in the Apex Controller With Get/Set methods, every time apex controller method is invoked it synchronizes the all the attribute from Client- Server and vice-versa , Also the method call was sunchronous. To control the latency and performance ViewState was Used.
Lightning : Client & Server component is loosely coupled - All the attribute are defiend at the client and populated intially and maitained at client side only till you don't explicitly enque the action. This too happens asynchronously and you choose the amount of data that trasits to and fro.
So now client-server communication is not framework controlled but developer controlled (Bad design / development can make lightning application real patchy and slow)and that is the reason we don't have viewstate.