Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Unhandled Rejection (TypeError): _this2.setState is not a function

I’m new using React and I’m having this error to use the search bottom in my application.
this the error

This is my code

code

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

[enter image description here][3]
I’m also new in stackoverflow, let me know if you need more information.

thank you.

>Solution :

There are a couple of methods how to fix the issue:

  • use an arrow function instead:
search  = (terms) => {}
  • Bind this into your functions you intend to use this.search = this.search.bind(this); inside your App constructor() after this.state

Have a look for more details: React – How to fix this.setState is not a function error

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading