In this blog post, we find out more about Salesforce Lightning Components and dig a little bit deeper. It is always an added advantage if you have some extra knowledge. So let’s dive in and learn more about Lightning Components.
Lightning components are loosely coupled app modules. They adopt a plug-n-play approach for the developers. So have you ever thought, how these loosely coupled components interact with each other? How they work together? Let’s have a look.
ALL ABOUT LIGHTNING EVENTS:
The question is what are lightning events and how they work.
WHAT: Lightning events are used to interact with lightning components. Components declare the events they send out along with the components they can handle.
HOW THEY WORK: Events are fired via JS Controller actions that are triggered by the user using the interface.
TAG: It is represented by using the following tag:
TYPES Of LIGHTNING EVENTS:
- System Events
- Browser Events
- Application Events
- Component Events
- Navigation Events
Let’s understand them one by one
System Events: Lightning Component Framework has a set of events which are used to notify components that something important has been done by the framework.
init – It is sent to components when they are initially loaded
re-render – It helps the system to understand that a component needs to re-render after an event
Browser Events: They are not particular to the lightning framework. They are browser notifications that are fired whenever the user interacts with an element.
Application Events: It is useful when one needs to have integration between lightning components that live on same and different namespaces. They work like a publish-subscribe model, i.e., one lightning component fires the event, and all lightning components that have subscribed to the event gets notified. Their propagation preserves the framework’s default handling behavior. It controls the behavior of handler and helps them to interact with the event.
Component Events: It is useful when one wants to pass information from Parent components to child components. It is fired from an instance of components. It can be handled by the component that fired the event or any parent in the hierarchy. They interact with the event and control the behavior of the event.
<aura:attribute name="text" type="String"/>
Navigation Events: It enables components interaction within Lightning Interaction and Salesforce1.
force:navigateToURL (It helps to navigate to specify URL)
WHAT IS LIGHTNING BASE COMPONENTS?
They are the basic building blocks which are accessible through codes. They build up a user interface for Lightning Experience, Communities, and Salesforce1. They handle HTML and CSS. Now it is not necessary anymore to use static resources always. One can simply use pre-defined components as well.
WHAT IS LIGHTING DATA SERVICE???
One can easily load, create, edit and delete a record in the component without using any Apex code. It handles field level security and sharing rules for you. It resembles “Standard Controller” in visualforce pages. It includes the following:
It doesn’t render any UI but put a standard controller for visualforce pages inside lightning components. It provides the ability to create, read, update and delete records in components. It uses following methods:
Shared Record Cache: There is no need to search the server every time if they make any changes.
Offline Support (Draft): It is planned for future and not yet developed fully. According to this, It means that we will be having a lighting page with all lightning components working with record data in the cache. It will be handy if one doesn’t have an internet connection. Isn’t it sound exciting? We can access our data independent of internet connection. COOL!!.. Let’s wait for this super-exciting feature.
Benefits of dynamically creating components:
No doubt lightning components are flexible, i.e., they can be changed depending on the requirements.
LC’s are reusable since they have a modular design. Components can be reused for different solutions.
- Room for Growth:
Dynamically created components can be extracted. It is just like the cherry on the cake. LC’s provide us the components which always have that extension feature. They are not limited to any one thing.
Never confine yourself with limited knowledge. Always try to learn new things and grasp them quickly. It is always a necessity to keep pace with the enhancements happening in technology on a daily basis. Thus, there is always a lot more to learn and explore.
This Post Has 2 Comments
Thank you for sharing excellent information. Your article is so cool. I am impressed by the details that you have shared with this article on Lightning Components.
Hi Sheen, Appreciate your kind words. We are glad you like it.