The aim of the section is to demonstrate how to build a simple Lightning Component via the Salesforce Developer Console. We will also explore how to create a simple application to test our component.
The simplest way to create a Lightning Component is to use the Salesforce Developer Console. In later chapters, we will get familiar with source-driven development and the use of an Integrated Development Editor (IDE). For now, let's use the Salesforce Developer Console:
- Open the Salesforce Developer Console:
![](assets/d86c8f60-a549-4428-ac15-dbbddd7b71f4.png)
- Use the File menu to create a new Lightning Component:
![](assets/c3b6e04c-d614-46a0-942c-c69e76fa8b8a.png)
- Name the component. Let's name it HelloWorld for now.
- Enter the following code in the component markup and save it (command + S):
<aura:component >
HelloWorld
</aura:component>
- Let's test this on the browser. To test this, we will need to create a Lightning Application. Go to the File menu, as we did in step 2, to create a Lightning Application. Let's name the application HelloWorldApp, enter the following code, and save it (command + S). Notice we have used the HelloWorld component in the aura:application tag to reference the component.
<aura:application >
<c:HelloWorld/>
</aura:application>
- Click on Preview in the application and make sure the browser renders HelloWorld. The following screenshot shows the preview and the application:
![](assets/d79aa1fd-a7fc-4ad1-a09b-1c200b3a9934.png)
- You will see that there was a unique URL generated as Salesforce_domain/c/HelloWorldApp.app. Notice that c is the default namespace. For a managed package application, your organization may have a namespace and then the namespace is used in the URL generated instead of c. Also, note that Salesforce_domain is the domain name of your Salesforce instance. The following screenshot shows how the component markup is rendered on the browser:
![](assets/679b4d53-c2a6-4f05-8cb2-ab1e3f8358c9.png)