I get a ts error from my response component. The component works fine, builds, etc., however, typescript shows an error inside ide. I don’t know how I need to declare this in order to remove the error. I tried to create the setState method inside the component itself, but this gave even more errors.
Error: (15, 19) TS2605: JSX element type 'Home' is not a constructor function for JSX elements. The 'setState' property is not in the 'Home' type.
"typescript": "^ 2.3.4",
"respond": "^ 15.5.4",
"reaction-dom": "^ 15.5.4",
! ----
export class App extends React.Component<Props, State> {
public state: State
public props: Props
constructor(props: Props) {
super(props)
this.state = {
view: <Home />, <<<<
}
- the rest is removed for brevity
export class Home extends React.Component<Props, State> {
public state: State;
public props: Props;
constructor(props: Props) {
super(props)
}
public render() {
return <h1>home</h1>
}
}