Using .bind() in render
See original GitHub issueCan this bind be moved outside of the render life-cycle (outside of render)?
https://foxhound87.github.io/mobx-react-form/docs/getting-started.html
<input {...form.$('username').bind()} />
If the form is re-rendering outside of mobx then this bind is going to unfortunately ensure react will consider the virtual DOM different and force it to update the real DOM even if the rest of the render did not change.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
bind(this) in ReactComponent.render() method - Stack Overflow
Oh, my original intention was to use bind in the render() method because the relevant code should group together.
Read more >This is why we need to bind event handlers in Class ...
We need to bind these methods to the component instance using .bind() in our custom component's constructor. class Foo extends React.
Read more >Passing Functions to Components - React
Using Function.prototype.bind in render creates a new function each time the component renders, which may have performance implications (see below).
Read more >Properly using .bind() in React and understanding ... - Medium
“I'll just have to .bind() all of my component's methods to this , inside the constructor, and everything will be working fine again”....
Read more >Best Alternative to Binding in Render - Dave Ceddia
If you're using React.createClass , the member functions in your component are automatically bound to the component instance. You can freely ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m not using the lib at the moment so I really can’t do a test case. I think your on the right track though if this is a safe change and something you want. I’m just giving a tip that I think will help your examples look good.
Thanks for the suggestion, really appreciated. I’m going to close this issue, feel free to reopen if you need.