Skip to content

Commit a89ace9

Browse files
Save selected entity in the state
1 parent 8a49877 commit a89ace9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/components/App.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ class App extends Component {
1414
constructor(props) {
1515
super(props);
1616
this.state = {
17-
treeData: treeData
17+
treeData: treeData,
18+
selectedEntity: null
1819
};
1920
}
2021

@@ -51,7 +52,10 @@ class App extends Component {
5152

5253
updatedTreeData = updateChildren(updatedTreeData);
5354

54-
this.setState({ treeData: updatedTreeData });
55+
// Log selected entity
56+
console.log(`Selected ${payload.type}:`, payload.name);
57+
58+
this.setState({ treeData: updatedTreeData, selectedEntity: payload });
5559
}
5660

5761
render = () => {

0 commit comments

Comments
 (0)