Why AND How To Write Your First Salesforce Lightning Component Using Aura
There’s a reason why being a Salesforce Developer is one of the most lucrative jobs on the market. One of those reasons are Lightning Components. Salesforce Lightning Components using Aura are great for the following reasons:
- You can write it right inside of developer console
- You are able to make use of HTML markup and CSS stylesheets for complete control over how your code looks
To write an Aura Lightning Component you will be utilizing the MVC (Model / View / Controller) architecture.
- Model: This would be your Salesforce database. Your lightning component can connect to your salesforce database seamlessly and allows you to access your data through your Apex controller class.
- View: This would be your HTML markup. In your aura component you are able to include HTML, CSS, Aura tags and Lightning tags. This allows for much control over the display and view you are able to provide to your users.
Let me give you an example of how to get started. You will be working with 4 files.
- Lightning Component (TestAura.cmp)
- Apex Controller Class (TestAuraController.cls)
- Lightning Component App (TestAura.app) — Optional
Here is a link to a basic custom Lightning Component built using Aura that will display a list of Accounts.