New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jsx-no-bind - active for custom components only #413
Comments
This is something I'd like to see too. Would a PR for this be welcome? If so, I can work on it. |
@janmarek the issue is that |
The performance of This is obviously very undesirable for custom components, but for a If I have a list of a dozen or so options that gets rendered infrequently (and I often do), I don't much care about the overhead of Right now, my options are to disable this rule on the lines where I use |
Why are you using |
To pass additional parameters to an If you know of a better way to do that, I'd love to hear it. |
@mindjuice |
Bind and arrow functions have the same effect here. Both of them create a new function. And both are ok with HTML nodes but not with custom components because of that shouldComponentUpdate. |
@janmarek "a new function" isn't the problem, |
I guess bind has two problems and arrow function has only one then. |
The arrow function will not work if you are using a plain loop to create your In my case we're using I still believe that an additional option, as I described above, would be useful. eslint's job isn't to tell developers how to write their code, but to give them tools with the flexibility to let them enforce whatever rules they choose. |
@ljharb |
This rule now has the |
Hi.
I'd like to use this rule to avoid problem with shouldComponentUpdate mentioned in this article https://medium.com/@esamatti/react-js-pure-render-performance-anti-pattern-fb88c101332f#.i77y134gm (section Functions create identities too).
But this is only a problem on custom components. HTML elements like or so don't have shouldComponentUpdate, so binding functions is much smaller problem there.
Currently I have 126 jsx-no-bind warnings in my app and I'd like to fix the important ones first. It'd nice to be able to turn this check on custom components only (their names start with a capital letter).
Thank you
The text was updated successfully, but these errors were encountered: