About ".html" File :
Default namespace for LWC = c
Suppose,1st LWC name = helloWorld
Now, let's assume, you're trying to create 2nd LWC and you want to use the 1st LWC then below is the syntax.
<template> <c-hello-world> <!-- [defaulNameSpace][hyphen] [each word of LWC name is separated with hyphen] --> </template>
Now, let's assume, you're trying to create 2nd LWC and you want to use the 1st LWC then below is the syntax.
<template> <c-hello_world> <!-- [defaulNameSpace][hyphen] [each word of LWC name is separated with underscore] --> </template>
example:
import { LightningElement } from 'lwc'; export default class HelloWorld extends LightningElement { //Your logic }
lwc = Core module/Service component/library.
LightningElement = Custom wrapper of Standard HTML element.
import = Statement imports the LightningElement from the lwc module.
extends LightningElement = To create a js class for LWC.
If you observe the class name, it is following a naming convention called "Pascal case".
Pascal case = First letter of every word must be in Upper case.
Optional Files:
Comments
Post a Comment