1. Create a child component with props
handleCallBackProp?:(data:string)=> void;
set the value in props on button click or change or where you want to update the parent component
props.handleCallBackProp!("Chield Value");
2. Now go to parent component and create a call back function like below
const handleCallBack=(value:string)=>{ alert(value); }
add the props con the child component like below
handleCallBackProp={handleCallBack}
No comments:
Post a Comment