I am trying to pass value from parent LWC component to child LWC component, but i am getting "undefined" error. Am i doing anything wrong.
Parent :
<template>
<div>
<lightning-input type="text" value={checknameinputvalue} name="CheckName" label="Check Name" required></lightning-input>
<lightning-button label="Generate" title="Generate" class="slds-m-left_x-small" onclick={handleClick} ></lightning-button>
<c-cHildTestLWC check-name={checknameinputvalue}></c-cHildTestLWC>
</div>
</template>
JS:
import { LightningElement, track } from "lwc";
export default class TestcheckDetails extends LightningElement {
@track checknameinputvalue;
handleClick(event) {
this.checknameinputvalue = event.target.value;
console.log(event.target.value);
}
}