I believe i have declared the interface
with correct way and implemented with class. but still getting an error as :
Property 'show' does not exist on type 'Readonly<{}>'.ts(2339)
any one help me understand further here?
here is my code :
interface GlobalForm {
show:boolean
}
export class Footer extends React.Component<GlobalForm> {
constructor(props:GlobalForm){
super(props);
this.state = {
show:false
}
}
globalForm = (event:React.MouseEvent):void => {
event.preventDefault();
this.setState(() => ({show:!this.state.show}))
}
error:
Change your class decleration to this:
export class Footer extends React.Component<{}, GlobalForm> { ...
the state types should be in the second parameter