These questions are basic and medium level questions and will be helpful for everyone.
- 1 What are Lightning Web Components (LWC)? …
- 2 What is the file structure of Lightning Web Components. …
- How can you display components HTML conditionally. …
- 4 How we can bind data in LWC. …
- How we can pass data from HTML to JS controller?
Indeed, What is difference between LWC and Aura components?
Aura-based Lightning components are built using both HTML and JavaScript, but LWC is built directly on the Web stack. A developer who works on LWC is not only using coding skills on a particular framework but in other frameworks like React or Angular, which are based on the Web Stack.
Then, What is Salesforce LWC? In Salesforce, Lightning Web Components (LWC) are a revolutionary change in the lightning platform programming paradigm. If you are new to Lightning Platform and you have been developing solutions outside of Salesforce with the help of HTML and JavaScript, then you will find LWC is a piece of cake.
What are the advantages of using LWC over Lightning components? Main advantages of using LWC over Lightning Components, are:
- LWC is Fast.
- It automatically provides polyfill for older browsers which yet not support all underlying web standards (shadow dom, web components, etc.)
- Improved API support for third-party APIs.
- It is light weight.
In the same way What is Shadow DOM in LWC? Shadow DOM is a standard that encapsulates the internal document object model (DOM) structure of a web component. Encapsulating the DOM gives developers the ability to share a component and protect the component from being manipulated by arbitrary HTML, CSS, and JavaScript.
How is event handled in LWC?
LWC uses standard DOM events to create and dispatch events.
…
The DOM events system is a programming design pattern that includes these elements.
- An event name, called a type.
- A configuration to initialize the event.
- A JavaScript object that emits the event. For example – if you change the dispatch statement to this.
What is slot LWC?
LWC: The most advanced frontend framework in Salesforce. A slot ( <slot></slot> ) is a placeholder for markup that a parent component passes into a component’s body. The concept is similar to Visual Force’s composition.
What is view encapsulation Angularjs 7?
View encapsulationlink. In Angular, a component’s styles can be encapsulated within the component’s host element so that they don’t affect the rest of the application. The Component ‘s decorator provides the encapsulation option which can be used to control how the encapsulation is applied on a per component basis.
What is the difference between Shadow DOM and virtual Dom?
Differences between Shadow DOM and Virtual DOM
Virtual DOM is creating a copy of the whole DOM object, and Shadow DOM creates small pieces of the DOM object which has their own, isolated scope for the element they represent.
What is event target in LWC?
target vs event. detail. 1. When child component trigger an event it comes as detail if event trigger by DOM then comes as target.
What is reactive property in LWC?
By default all the properties are reactive in LWC, as in, once a property is created and used in a template file, when the content of the property is changed, the modified data gets reflected in all the places it is used (this behaviour is valid only when the property is used in the template file).
What is connected callback?
The connectedCallback() is a lifecycle hook in lightning web component . It fires when a component is inserted into the DOM. It runs once when the component inserted. connectedCallback() in Lightning Web Component flows from parent to child.
Why do use slots in LWC?
Slots in LWC are useful to make Lightning Web Component reusable and more flexible. It is also used to create a template in Lightning Web Component where we can create dynamic sections where the markup can be populated dynamically.
Why are there slots in LWC?
When you want to send markup (maybe some HTML code or HTML markup with predefined slds class names) from parent component to child component this is where slots in LWC are used. So, the gist is, use properties to send data from parent to child components and use slots to send markup from parent to child component.
Which decorator is used to define public method in LWC?
To expose a public property, decorate a field with @api. Public properties define the API for a component. To expose a public method, decorate it with @api.
What is AngularJS scope?
AngularJS Scope
The scope is the binding part between the HTML (view) and the JavaScript (controller). The scope is an object with the available properties and methods. The scope is available for both the view and the controller.
Which of the following is not an AngularJS directive?
Q 2 – Which of the following is not a core AngularJS directive. ng-state is not an AngularJS directive. Q 3 – AngularJS application expressions are pure JavaScript expressions.
What is host in Angular?
Every component is associated within an element that matches the component’s selector. This element, into which the template is rendered, is called the host element. The :host pseudo-class selector may be used to create styles that target the host element itself, as opposed to targeting elements inside the host.
What is reconciliation in Reactjs?
The reconciliation process makes React work faster. Reconciliation is the process through which React updates the Browser DOM. Important concepts behind the working of the Reconciliation process are: Virtual DOM. Diffing Algorithm.
Is React better or Angular?
Is Angular better than React? Angular is better than React if your application is enterprise-grade and you need to incorporate complex functionalities like progressive, single-page, and native web apps. However, React specializes in creating UI components and can be used in any application, including single-page apps.
Does Angular use shadow DOM or virtual DOM?
Angular2 doesn’t use shadow DOM (default) nor virtual DOM.
What is the difference between event target and event currentTarget?
target is the root element that raised the event. currentTarget is the element handling the event.
What is renderedCallback in LWC?
From the documentation, we know that renderedCallback method is called when component is completely rendered and it can be called multiple times. So if we want to perform any operation after rendering, we would put that code inside renderedCallback.
What is @track in LWC?
@track is like a private method in your apex class which means you can only access @track in your local LWC file as these properties are strictly inside the component. You can use a @track property directly in a template and indirectly in a getter of a property that’s used in a template.
Don’t forget to share this post !