LWC – Basics

November 9, 2022

Lightning web component creation is one, two, three steps. I’m not kidding. It’s really that simple.

You create

(1) a JavaScript file

(2) an HTML file, and

(3) a CSS file. (Optionally)

At minimum, all you really need is an HTML file and a JavaScript file with the same name in the same folder (also with a matching name). You deploy those to an org with some metadata and you’re good to go. Salesforce compiles your files and takes care of the boilerplate component construction for you automatically

Practise Here


Component Reference!


Best Example for Quick Revision


<?xml version="1.0" encoding="UTF-8" ?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <masterLabel>Product Card</masterLabel>
        <targetConfig targets="lightning__RecordPage">