The concept of web components

With web components, you can do almost anything that can be done with HTML, CSS, and JavaScript, and they can be a portable component that can be re-used easily.

Lightning Components are based on this idea, where each individual component consists of one or multiple components that use Apex, JavaScript, HTML, and CSS on top of Salesforce metadata to build a completely functional unit that can work on multiple Salesforce instances and multiple pages.

To understand how web components work, let's consider the following image. This shows how a page can have multiple components. It's also important to note that, since each of the components can consist of data from a third party, and if components from different namespaces can scrap data, it can diminish data security. Hence, Salesforce has a security mechanism known as Locker service to prevent data from being accessed.

It locks the DOM of the component and, hence, the JavaScript code from the component cannot access data from other components:

A Lightning page can have multiple components. They can be as small as a button component or can consist of components from different namespaces and different vendors. A component is a reusable unit and can be reused in Lightning Experience and Salesforce 1. To make these components interact with each other, the framework provides events. We will explore Lightning events in later chapters.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.135.175