You need to sign in to do that
Don't have an account?

when we have to use wire method to call apex method we can call apex method on connectedcallback or on event method like onchange or conclick then why we use wired to call apex
when we have to use wire method to call apex method
we can call apex method on connectedcallback or on event method like onchange or conclick
then why we use wired to call apex
we can call apex method on connectedcallback or on event method like onchange or conclick
then why we use wired to call apex
Decorate a Property with @wire
Wiring a property is useful when you want to consume the data or error as-is.
If the property decorated with @wire is used as an attribute in the template and its value changes, the wire service provisions the data and triggers the component to rerender. The property is private, but reactive.
Decorate a Function with @wire
Wiring a function is useful to perform logic whenever new data is provided or when an error occurs. The wire service provisions the function an object with error and data properties, just like a wired property.
The function is invoked whenever a value is available, which can be before or after the component is connected or rendered.
Refer the below help article with example.
https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.data_wire_service_about
If this helps, Please mark it as best answer.
Thanks!!