Adding one LWC component within body of another LWC component is known as component composition. It allows building complex component from simper building block component.
How to refer child component from parent component ?
1. childComponent <c-child-component></c-child-component>
2. childComponentDemo <c-child-component-demo></c-child-component-demo>
3. childComponentLWC <c-child-component-l-w-c></c-child-component-l-w-c>
This naming convection known as kebab case. Replace capital letter with small and prefixed with hypen.
Advantages - Defining smaller component will make testing easy and reusability.
No comments:
Post a Comment