I have two components the Root Component that contains list of data. the data is displayed from firebase. the second component is a DateRangepicker that helps picks to dates so We can filter the root's component data.
class Child extends React.Component {
pickDateRange = (e: React.FormEvent<HTMLFormElement>) => {
// getting data successufly from firebase
// this is where I get the error trying to set the root component's props
this.props.data = data
}
render() {
return (
<div>
<form onSubmit={this.pickDateRange} className={classes.container} noValidate>
<TextField
id="datestart"
label="Starting Date"
type="date"
onChange={this.handleStartDate}
/>
<TextField
id="dateend"
label="Ending Date"
type="date"
onChange={this.handleEndDate}
className={classes.textField}
/>
<Button
type="submit"
>
Filter
</Button>
</form>
</div>
);
}}
class Parent extends React.Component {
render() {
return (<div> <ChildB data={this.state.data}/></div>)
}}