In my app I have this line of code:
var newMatrix = this.state.matrix;
I would like to set 'newMatrix' to a copy, not a reference, of 'this.state.matrix'. 'this.state.matrix' is a 2D array populated with React components which will eventually be rendered into a grid on the screen.
What would be best practice to deep copy it into the new variable?