score:1

Accepted answer

you are rendering childdata based on this.state.childdata which will be referenced by both the parents.

i suggest you change the structure to something like

 this.state = {
            parentdata: [{
              "title": "parenttitle",
              "id": 1,
              "childdata": [{
                 "title": "child1",
                 "id": 1
              }]
            }],
            loading: true,
            id: '',
        };

i have created a fiddle with the solution you require. https://jsfiddle.net/8w0o5a2m/1/ i have removed the async functions from code for simplicity


Related Query

More Query from same tag