I'm using react.js, and I want to obtain from the state an array, but I required to clone it and save it into a const. I can do it with two lines of code; exists a way to do it in a single line of code?
Example:
const { data } = this.state
const newData = [...data]
FYI, I'm using eslint, and with "parser": "babel-eslint" config and VSC show me a warning if I'm trying to do this:
const data = [...this.state.data]
Warning message: Must use destructuring state assignments - lint react / destructuring-assignment
I don't want to remove/customize the rules of eslint... but I don't want to extend the code more than necessary.
Any suggestion?