Tips To Develop Lightning components

As a Salesforce developer I was good at developing almost everything in Salesforce but I had no knowledge about development in lightning and suddenly I got a chance to work on a project using lightning. Now I am amazed to develop everything in lightning.

Things you get ready made and unique in Lightning Component:

Look and Feel – User gets built in UI in lightning. As developer just have to apply respective css classes to the lightning component elements.

Interfaces – While creating lightning component it asks bundles to select, so that developer don’t have to worry about copying the interfaces from browser.

Single Page Application – It is single page application. The best thing about it it loads the page once, and perform activities when user interact with the page. It means lightning component is more of a client side application.

Events – This is the magical and interesting part of lightning component to communicate with other components even if the have in relationship between each other.

Responsiveness – Due to inbuilt css and javascript, lightning component makes dynamic appearance. So once developed no need to worry about mobile view or desktop view. Much time saving to manage responsiveness.

Easy to fit in other places – Lightning component can be used in anywhere in salesforce except javascript action button. You can use it in Visualforce page, Lightning app, Record page, Standard button (New/Edit), other lightning components, flexipages etc

Aura framework – Lightning component has got an aura namespace, which has got its own elements like ui namespace has inputtext,button etc. It has got attributes which works as variables to hold the data and perform some operations.

Lightning Application:

The powerful tool to use lightning component in visualforce page.

Act as a container for Lightning component to easily develop apps.

How to use lightning component in visualforce page:

First of all why to use lightning component in visualforce page?

To override New standard buttons of records where you need parent id to save child record. Developer won’t get parent id through related list of parent record using lightning component so there he/she needs standard visualforce page to bind with lightning component.

Lightning application plays a vital role to connect lightning component and visualforce page.

Following are the steps to get parent record id while saving child record from related list in lightning experience:

Types of expression in lightning component to pass data from one component to another:

Bound Expression

Unbound Expression

Bound expression : These expression are used with the aura:attributes. They are symbolically defined with ‘!’ (exclamation). If you use them and perform some operation at javascript then you can see the result on component if they are exposed. The big use of them is in parent child relationship lightning component structure. You can easily access child components attribute in parent component as below:

Unbound Expression : These expression are also used with the aura:attribute. They symbolically defined with ‘#’. If you don’t want to show operated result on lightning component make use of them. So in above example if you send something from parent component to child component and you don’t want to get back the changed value from child component in parent component then make use of this expression.

So this is how you can take care of basic things about Lightning Component. I will be publishing 2nd part of this blog very soon. It will cover Lightning Events.

If you know some great tips apart from this please let us know in the comments 🙂 !!!

Thinqloud was founded by a team of Salesforce enthusiasts whose expertise lies in a range of services which include consulting, customization, automation, integration, and product development on the Salesforce® platform.