Lightning Web Components are announced as part of Spring19 pre-release and would be generally available from Spring19 release.
What are Lightning Web Components?
If you talk about look and feel, LWC are pretty similar to your existing Lightning Components but there is a lot has changed on architecture level. Where Lightning Component uses its own component model and programming standards, LWC uses modern web programming standards, shadow DOM, modules and ECMAScript7. LWC are faster on the performance level, as most of the feature implemented natively web engine.
Should you learn Lightning Component Development first before I can start with LWC?
Not needed, having knowledge of Lightning Framework or any other web framework like React, Angular may help you in some way to understand LWC faster or but it is not mandatory. You can directly start learning LWC, with a little bit of exploration and practice, you should be able to develop your own web components very soon!!
Where would Lightning Component go?
They are not going anywhere 😃. What is more exciting is, LWC and Lightning Components can easily talk to each other and you can use both of them on the same page.
How to create a Lightning Web Component?
Unfortunately, you cannot create LWC directly from your developer console. You need to SFDX to create your lightning component. Please watch this video on how to setup SFDX for your org:
Once you have SFDX setup, there are few more things you need to do:
- Sign up for a Spring19 pre-release org.
- Update SFDX plugin with Spring19 pre-release. Run below command in either your terminal or command prompt.
sfdx plugins:install salesforcedx@pre-release
- Once this is done, follow this trailhead link to set up and basic project and create a basic lightning web component.
I have created a pretty basic calculator web component which allows the user to perform the basic operation like addition, subtraction, multiplication, and division.
This file has the UI layer code. Since we are developing web component, the file type is no more .cmp, we are back to classic .html file type now.
This is meta-data file where component’s meta properties will be stored. Here we will define that our web component will be available for Lightning App Page, Record Page, and Home Page.
This is pretty basic Lightning Web Component that I have created and this is my first LWC as well. Let me know if you find any scope of improvement as I am still learning LWC. Stay tuned for more awesome Lightning Web Components.