I need to use state value that is inside child component in parent component.
The component:
export default function Children(props) {
const [data,setData] = useState('')
const handleChange = (e) =>{
e.preventDefault();
setData({[e.target.name]:e.target.value});
}
return(
<Component onChange={handleChange} name={props.name} label={props.name} variant="outlined" />
);
};
and this is the parent component:
export default function Parent(){
return(
<div>
<TextArea name="One"/>
<TextArea name="Two"/>
<TextArea name="Three"/>
</div>
);}