0

How should get the object context on child component. We have LWC as parent child on record page. I can able to read the record context this.ObjectApiName in parent component but not in child component.

Is there a way to pass from parent to child as this.objectAPiName can be initiliazed in connected call back or in any event call only.

1

In the child, you use:

@api objectApiName;

And in the parent, you set the value:

<c-child object-api-name={objectApiName}

These values should be available in the connectedCallback.

1
  • Thanks sfdcfox. Appreciate your answer. i tried this little differently. I think what you r mentioning is pass objectApiName itself to child objectApiName.I will try it out. I was passing parent objectApiName to a variable on child... – sfnerd Nov 6 '20 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.