naisutech/react-tree

Tree not re rendering after button click and updating data?

Closed this issue · 3 comments

Tree not re rendering after button click and updating data?
onMck = () => {
        this.setState({data :[{
            "id": 87654325,
            "label": "My file9",
            "parentId": 56789012
        }]});
        console.log(this.state.data);
        // document.getElementById("mtree").innerHTML = createTree(data)
    };

<button onClick={this.onMck}/>

<Tree nodes={this.state.data} onSelect={this.onSelect} theme={'my-theme'} customTheme={myTheme}/>

is this.state.data empty before your button press?

this should be fixed now in v2. Let me know if it's still a problem