Am I updating the state right?
this.state = {
exampleGraph:{
nodes: [],
edges: []
}
fetchState(){
//api call with list of values
this.setState({exampleGraph:{nodes: api_res.nodes, edges: api_res.edges})
}
Not the exact code but I'm doing something like this.
which gives me the following error
Error: Cannot add item: item with id 1 already exists
Stacktrace shows:
this.setState(
{
exampleGraph: {nodes:node_list, edges: api_res_edges},
}