0

I am trying to assign value to a property of my parent component's constructor method. Below is the html code:

<template>
   {welcomes}
 
<c-testfile></c-testfile>
    </template>
    

Below is the js code:

import { LightningElement } from 'lwc';
export default class testfile extends LightningElement {

    constructor() {
        console.log('inside constructor');
        super();
        this.welcomes='mine';
    }

}

I am calling this lwc component from an aura component and when I am running the aura app, the constructor is called multiple times and I am getting the below error:

enter image description here

Why the constructor is called multiple times here?

1 Answer 1

-1

My bad. I was calling the same parent component in my HTML as a child component. Hence it's going in a recursive mode.

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.