Destructuring a function call

Tags: , , , ,

Assuming the following code:


EsLint gives out the following error:

Must use destructuring props assignment  react/destructuring-assignment

While the current code is clear and concise, if I still wanted to destructure the code and make EsLint happy, how could I do it ?


The docs for this rule say that properties of props should be destructured before using them, so just do that:

const { myFunction } = this.props;

Source: stackoverflow