Search code examples
reactjstypescriptreact-class-based-component

Unable to pass state in TypeScript


enter image description here

I'm having issue on the line 24. If I try to declare "query" the same way as on the line 13, warning disappears, but later when I call the function it passes "underfined" there.

enter image description here


Solution

  • You need to use query from state like this

    ${this.state.query}