'How can I reference my array of markers using setState?
I have some old code that used to run but now I receive a warning. When fixing it using setState, I get a simple syntax error. Obviously I am misunderstanding something but not sure what. I have provided a snack example here that reproduces my error exactly.
calling setState causes error - Do not mutate state directly
I also included my original line below. It used to work fine.
From looking at a similar question I tried using just this.state.markers which gives the same error.
I appreciate any and all insight more than you know.
ref={ref => this.state.markers[index] = ref}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
