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

Viewed 153

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.

0 Answers
Related