Lightning Web Components Book
Lightning Web Components Book
In that process you will get a fair understanding of the main concepts used in LWC, you
will be able to understand how things work behind the scenes and best practice to build
Lightning Web Components.
This works very well in case you want to revise all the key accepts in LWC in less than an
hour.
However, there are a lot of other things that’s not mentioned in the book, as the purpose is
to keep it simple, make sure you understand the basics and get started.
Any Prerequisites?
I have prepared this zine with the assumption that you know Aura components. However,
in case you don’t know Aura components, it shouldn’t be a problem when it comes to
understanding LWC.
What’s next?
Follow me @kkteja on Twitter for more updates.
Table of Content
Introduction
What’s the Lightning Experience
WhyLightning?
Why not ReactJS or other frameworks?
What are Aura components?
What’s the problem with Aura Components?
Why LWC?
Should I start with Aura or LWC?
What is component based framework?
Give a requirement how can I break it in to small reusable components?
LWC in Detail
Variables vs Attributes vs Properties
DataBinding
Conditional Rendering
RenderingLists
Few things to know about Decorators
Terminology & Behaviour of Components
Data Flow
Slots
What’s DOM
What’s shadow DOM
Working with static Resources
Calling API from JavaScript
Life Cycle Hooks
<lightning-record-view-form></lightning-record-view-form>
<lightning-record-edit-form></ lightning-record-edit-form>
Events
How to work with basic Events
How to pass data in Events
Handle Events
Programatically
Declaratively
Phases in Events
Bubbling
Capturing
Various configuration in LWC
A little about pub-sub
Navigation in LWC
Lightning Out
Aura Coexistence
Introduction
Lightning Experience is representation of salesforce in a new way altogether.
Salesforce took the advantage of modern JS and rebuilt quite a few things.
Why Lightning?
Salesforce already had Apex & Visualforce which are pretty much mature.
But they were built keeping in mind desktop computing. Back then mobile computing was
not a thing.
Also, in parallel around 2015 there is a huge shift in IT sector because of JavaScript.
Earlier when we wanted to build a desktop app, we had to do it in three variants, once in
Windows, Once in Mac and once in Linux. With ElectorJS things changed a lot. We write
apps in native HTML, CSS and JS and we can export a Windows variant, Mac variant and
Linux Variant.
When we had to build an app for iOS and Android platforms, we had to built in twice once
for iOS ecosystem and once for Android, with React Native things changed a lot.
Why LWC?
Salesforce wanted a framework that religiously follows web components standard and has
all the advantages of modern JS. Hence it had come up with LWC.
An example is, Google was working on a conceptual mobile phone called project Ara.,
where we can build a mobile phone by combining together camera components, battery
components, memory card component and etc.
What we do in LWC is pretty much similar. We build a feature but putting together small,
reusable pieces