LWC Interview Questions

Here are some of the LWC interview questions that might give you a hang of the LWC framework by Salesforce.

Let's focus on a few potential LWC Interview Questions that might help you in your upcoming interviews.

Is bi-directional data mutation possible in LWC?

No. Bi-directional data mutation is not possible in LWC.

When we want to mutate the data, we need to send the new data to the parent and the parent will push the data to the child component.

However, that’s not the case with Aura components.

In Aura Components when we have multiple components in hierarchy either of the parent or child can update the data and the same data gets reflected across other components.

How can we push markup from a parent component to a child component?

We use properties to send or push information from parent to child component.

We need to use slots to push markup from parent to child components.

How can we navigate a user from LWC component to another component?

We cannot directly send a user from one LWC to another LWC.

We need to wrap an LWC in an Aura Component and using navigation mixins in LWC we can navigate the user from LWC to Aura Component( which holds another LWC).

Can we use an LWC as a quick action?

Until Winter ‘21, using LWC as quick as the action was not possible.

Starting Spring ‘21 we can create an LWC and then include the appropriate targets in the XML file.

With that in place, we can use LWC as a quick action.

LWC when embedding in a lightning record page how can we access the recordId?

We need to create a property with the name recordId along with the decoration @api.

recordId is a special type of property and once an LWC with this property is embedded in a lightning record page, the recordId from the address bar is stripped and pushed it to the property recordId.

The framework does it automatically and this works only when the property name is recordId.