Answer the question
In order to leave comments, you need to log in
Why does the onBlur event in react-contenteditable always fire when an argument is passed to the method?
I'm using react-contenteditable.
It has an onBlur prop in which I wrote the handleChange method. If I pass the method without an argument , then everything is OK, but as soon as I change it to that is, any static argument, the onBlur event starts executing upon loading, with every click on almost any place, in general, it is hung on every element. onBlur={this.handleChange}
onBlur={this.handleChange('title')}
Answer the question
In order to leave comments, you need to log in
passing a method without an argumentonBlur={this.handleChange}
onBlur={() => this.handleChange('title')}
handleChange = (e) => {
const changeParam = e.target.getAttribute('data-change-param');
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question