Quantcast
Channel: User mykhailovskyi - Stack Overflow
Viewing all articles
Browse latest Browse all 29

react/jsx-no-bind warning even arrow function as const is passed

$
0
0

After starting new project with the latest stable React version (17.0.1) I noticed that in the strict mode I'm getting react/jsx-no-bind warn w\o using inline arrow function:

//...const cancelDeletion = (): void => setShowDeleteConfirmation(false);return (<div><Button onClick={cancelDeletion}>      {cancelText}</Button></div>);

What is the best way to avoid such warnings? I'm confused as I assumed that arrow function passed as variable does not lead to re-rendering of the component as it does when inline arrow function is passed. Meaning that this warning is not expected.


Viewing all articles
Browse latest Browse all 29

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>