39 Lightning Web Components questions pulled straight from real company interview experiences shared on this site (Deloitte, Amazon, PayPal, PwC, Cognizant, Accenture, TCS, Persistent and more). Click an option to instantly see if you got it right – no submit button needed.
Every question here is based on an LWC question that a real candidate was actually asked. Browse the original interview write-ups in Company-wise Interview Questions.
Score: 0 / 39
Question 1 of 39
What is the correct order of standard lifecycle hooks when an LWC component is created and rendered?
Question 2 of 39
Which lifecycle hook fires every time a component finishes rendering, and can fire multiple times?
Question 3 of 39
Which lifecycle hook lets a parent component catch and handle a JavaScript error thrown by a descendant component?
Question 4 of 39
Which lifecycle hook runs when a component is removed from the DOM, and is commonly used for cleanup like removing event listeners?
Question 5 of 39
What does the @wire decorator do in LWC?
Question 6 of 39
When should you prefer an imperative Apex call over @wire in LWC?
Question 7 of 39
In modern LWC (Spring '20 and later), what is the main purpose of the @track decorator?
Question 8 of 39
What base class must every Lightning Web Component JS class extend?
Question 9 of 39
Can you create a valid Lightning Web Component without extending LightningElement (or a subclass of it)?
Question 10 of 39
Which decorator exposes a property as public so a parent component can set it via an HTML attribute?
Question 11 of 39
Besides exposing public properties, what else is the @api decorator used for?
Question 12 of 39
Which module do you import in LWC to use the NavigationMixin for navigating to a record, list view, or URL?
Question 13 of 39
Can Lightning Web Components and Aura Components interact on the same page?
Question 14 of 39
Which statement is generally true when comparing Aura Components to Lightning Web Components?
Question 15 of 39
Can a Lightning Web Component be embedded inside a Visualforce page?
Question 16 of 39
What is the correct syntax to iterate over a list of items in an LWC HTML template?
Question 17 of 39
What extra capability does the iterator directive (iterator:it="items") give you that for:each does not provide directly?
Question 18 of 39
How does a parent LWC pass data down to a child LWC?
Question 19 of 39
How does a child LWC send data back up to its parent component?
Question 20 of 39
How do two sibling LWCs on the same Lightning App Builder page (with no parent-child relationship) typically communicate?
Question 21 of 39
How can an LWC placed on a record page get the current record's Id?
Question 22 of 39
How can you get the current logged-in user's Id in an LWC without making an Apex call?
Question 23 of 39
What is the purpose of @AuraEnabled(cacheable=true) on an Apex method used with @wire?
Question 24 of 39
What are the two main ways to call an Apex method from an LWC?
Question 25 of 39
What does refreshApex() do in LWC?
Question 26 of 39
Is it safe to call refreshApex() directly inside renderedCallback()?
Question 27 of 39
What is a JavaScript Promise, as commonly used in LWC development?
Question 28 of 39
What does Promise.all() do?
Question 29 of 39
In LWC, if a child component's @api property has a default value but the parent explicitly passes a different value for it, which value wins at runtime?
Question 30 of 39
Can a Lightning Web Component be used as a Quick Action?
Question 31 of 39
What does NavigationMixin.Navigate() let you do from LWC JavaScript?
Question 32 of 39
Which file in an LWC bundle contains the component's JavaScript controller logic?
Question 33 of 39
Which file in an LWC bundle declares metadata such as API version and where the component is exposed (Lightning App Builder, Flow, record pages, etc.)?
Question 34 of 39
How would you restrict a Lightning Web Component so it is only usable on the Account object's record page, not on other objects?
Question 35 of 39
A newly deployed LWC does not show up as an option in Lightning App Builder. What is a common cause?
Question 36 of 39
In LWC development, what is meant by "data leakage" as a security concern?
Question 37 of 39
How do developers typically debug a Lightning Web Component at runtime?
Question 38 of 39
How do you bind a JavaScript property into text inside an LWC HTML template?
Question 39 of 39
What does this.template.querySelectorAll(…) return when called inside an LWC?