Posts

Showing posts with the label recaptcha

How to resolve warning with ESlint: Disallow Assignment in return Statement (no-return-assign)?

Image
How to resolve warning with ESlint: Disallow Assignment in return Statement (no-return-assign)? I'm using the following package in my React application to generate a Recaptcha component: https://github.com/appleboy/react-recaptcha Here is what the component looks like, with the eslint warning: this.recaptchaRef is defined like so: this.recaptchaRef = React.createRef(); this.recaptchaRef this.recaptchaRef = React.createRef(); This ref allows me to reset the Recaptcha when there is an error with my form like so: this.recaptchaRef.reset(); this.recaptchaRef.reset(); How would I be able to resolve this error without writing ESlint comments? 2 Answers 2 Arrow functions, if there is no { following the => , will return whatever expression follows. At the moment, your arrow function is assigning event to this.recaptchaRef and returning event . (even if the consumer completely ignores the return ...