Trailhead is an interactive learning experience provided by Salesforce for developers to learn different areas of the Salesforce1 platform. The Lightning Component Framework is a powerful UI framework that allows developers to extend the Salesforce1 app with their own custom components. Trailhead has just released a new learning path for Lightning Components. This post reviews my experience completing it.
Lightning Components Module
The module started off by giving a high level overview of the various aspects of Lightning Components and what you can do with them. It also included a good explanation of key differences between Lightning Components and Visualforce. Next, the Lightning Component bundle was explained with an outline of the available pieces and you get to create your first component.
The next couple of units in the module get in depth about how attributes and expressions work. If you weren’t impressed by the Lightning Component framework yet, this is the part where you definitely will be. This is where you’ll see the power of it. The framework takes care of re-rendering whatever needs to be re-rendered anytime something changes that should cause it to, such as an attribute value changing. No code for DOM manipulation needed. No need to write code to handle complex dependencies. Simply set an attribute to have a new value and the framework takes care of everything.
Next was a unit on event handling which is another core concept of the framework. The unit is extremely detailed and covers framework events, the differences between component and application events, event best practices, and more. It ends with a useful challenge that has you code two components and an event to communicate between them. You should start to see how components can be designed and constructed to be loosely coupled.
After that, there is a unit about how to use Apex controllers in Lightning Components. This is a particularly useful unit that kind of ties everything together. Once you can connect the server and interact with the database, you can begin creating more practical components that would be similar to those you create for real in your company’s org or for your product (ISVs).
The unit on debugging Lightning Components is very informative as well. There are two things to which you should pay special attention. One is the interactive debugger. This is quite different than Apex debugging which doesn’t yet (saw something @ DF14 safe harbor) have an interactive debugger. The other interesting code to pay attention to is the logging code, whether by console.log or by subscribing to a log level and then doing something. Keep in mind that the logging that occurs does not get written to the Apex debug log, since it is on the client.
Takeaways and More
The Lighting Components Trailhead module is an excellent resource for jumpstarting your development with the Lightning Component framework. If you want to come up to speed in an easy and guided way this is the way to do it. In fact, I’d say no matter what, the Trailhead module should be the first stop on your learning train! In addition to the Trailhead module, the Lightning Components Developer’s Guide provides excellent documentation and some good examples that you can reproduce to learn more. Head on over to the Lightning Components Trailhead for an electric experience that will super charge your skill set!