Here is the code snippet I am working with:
interface State {
backgroundColor: boolean;
isLoading: boolean;
errorOccured: boolean;
acknowledgment: string;
}
export class GoodIntention extends React.Component<Props, State> {
...
onClickOfAgreement = (policy: string) => () => {
this.setState({backgroundColor: true});
...
}
render() {
return(
...
<table className={'checkbox-table ' + this.state.backgroundColor}>
<label>
<input className="checkbox-round" type="checkbox" onClick={this.onClickOfAgreement(policy)}/>
Agree and access my certificate and disc
</label>
</table>
...
}
Upon running the application, I encountered the following error in the browser:
TypeError: Cannot read properties of null (reading 'backgroundColor')
This error specifically points to line
<table className={'checkbox-table ' + this.state.backgroundColor}>
.
To address a previous error regarding
Property 'backgroundColor' does not exist on type 'Readonly<{}>'
, I added the State
interface based on guidance from this source. However, it seems like there might be something else that needs attention. Can anyone provide insights on what might be missing?