4 ms·
One note: From what I've read, using arrow functions as props in a render method of a component will create new functions each render, so you might end up with
by nbclark 9y ago
One note: From what I've read, using arrow functions as props in a render method of a component will create new functions each render, so you might end up with a good bit more GC than normal. There are some nice little mix-ins that will autobind to remove the need to remember to .bind everything.
- miroslavpopovic 9y agoNot using arrow functions in JSX code to define error handler. Yes, I believe you are right, that would create multiple handlers.
- Androider 9y agoNowadays you can just stick a class property anywhere in your React component: handleSomething = (params) => { ... }; and the use it in your render function like this without any binding: <Foo onSomething={this.handleSomething}/>
- nbclark 9y agoGood suggestion - Thank you
- miroslavpopovic 9y agoYes, class properties are the way to go.