Saturday, July 18, 2020

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

Hello All,

when we are using child component into parent component with in Lightning web componet some time we are getting error :Failed to resolve entry for the module

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

Examples:
Assume below names are the child component names

childNameInLWC
sampleTEST
sampleDataTableInfo
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-t-e-s-t></c-sample-t-e-s-t>
<c-sample-data-table-info></c-sample-data-table-info>
<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.