LWC Interview
LWC Interview
● Aura is a proprietary framework, while Lightning web components use standard web
technologies such as JavaScript, HTML, and CSS.
● LWC performs better than Aura due to its native web standards and effective rendering.
● Aura is proprietary, so developers must have adequate experience before using this
framework. On the other hand, LWC is easy to learn and helps developers become
familiar with standard web technologies.
1. Lightning Button
2. Lightning Input
3. Lightning Combo Box
4. Lightning Exchange
5. Lightning Design System
12. When is the Property or Wire Method called in the Component Lifecycle?
Wire methods or properties are called when any reactive parameter gets changed, and the
component is initialized. The @wire decorator ensures automated updates and data fetching.
16. What are Web Components? Is the Process of LWC Based on the Web
Components?
Web Components are a collection of web platform APIs that allow developers to create
reusable, contained HTML tags for custom elements. They consist of the Shadow DOM, Custom
Elements, and HTML Templates. LWC is built on Web Components and uses standard APIs to
develop fast, flexible, and reusable elements.
1. @track
2. @api
3. @wire
21. What is the difference between var and let in the Java Script?
‘var’ is the function scoped variable which can be redeclared. On the contrary, ‘let’ is the
block-scoped variable that cannot be redeclared within the same scope.
‘var’ declared variables are hoisted on the top of their scope. On the other hand, ‘let’ variables
offer better scoping rules and eliminate the issues related to variable hoisting.
25. When we face the Error of “Cannot Assign to Read Only Property” in the
Lightning Web Components?
This error occurs when you attempt to assign a value to a read-only property. In LWC, it can
occur if you attempt to directly change a public property passed down from a parent component
or if you attempt to edit the properties of an immutable object.
Properties: Parent components can send data to child components using public properties
marked with @api.
Events: Child components can communicate with parent components by triggering custom
events that the parent components can manage.
27. How can you Communicate from Child to Parent Component in LWC?
In LWC, communication between a child and a parent component happens through custom
events. The child component uses the CustomEvent constructor to dispatch an event, which is
then received and handled by the parent component.
For example: