3 ms·
Nowadays you can just stick a class property anywhere in your React component: handleSomething = (params) => { ... }; and the use it in your render
by Androider 9y ago
Nowadays 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.