Saturday, February 1, 2020

How to refer child components names in parent component in lightning web component(lwc)

When you are referring the child component name in parent component name in lightning web component some times you may face the error
LWC1010: Failed to resolve entry for the module

To resolve the error,  replace capital letters become lowercased and prefixed with a hyphen (-).

Examples:
Assume below names are the child component names

childNameInLWC
sampleDEMO
sampleDataTable
sampleDATAinLWC

refer above components like this in the parent component

<c-child-name-in-l-w-c></c-child-name-in-l-w-c>
<c-sample-d-e-m-o></c-sample-d-e-m-o>
<c-sample-data-table></c-sample-data-table>
<c-sample-d-a-t-a-in-l-w-c></c-sample-d-a-t-a-in-l-w-c>

Best practice tip
avoid more capital letters in your component name.


Resource
LWC Component folder

No comments:

Post a Comment