I am in the process of building a React app which I have used Create React App as the build-environment. Within one of my (class-based) components I have the following line within the componentDidUpdate()
method:
const toast = ([] = this.props.toast.toast);
If my understanding is correct, this is ES2016 syntax for setting default values if a variable is undefined. (Please let me know if this is not correct, although it's not the primary point of this question).
When my React app renders, I get the following warning in the console: Unexpected empty array pattern no-empty-pattern
.
I understand that ESLint "moaning" about the fact it's an empty array. But as I want an empty array in that situation, why does this cause a warning?
Can I simply tell ESLint to ignore it (using // eslint-disable-line no-empty-pattern
)?