react for dummies..
This commit is contained in:
parent
bd1ee0cfe9
commit
77404d0be6
1 changed files with 4 additions and 3 deletions
|
|
@ -10,11 +10,12 @@ class Tree extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadData() {
|
loadData() {
|
||||||
|
console.log(this);
|
||||||
axios.get("http://localhost:2048/callstack")
|
axios.get("http://localhost:2048/callstack")
|
||||||
.then(response => this.setState({ data: response.data }));
|
.then(response => this.setState({ data: response.data }));
|
||||||
}
|
}
|
||||||
|
|
||||||
clear() {
|
clearData() {
|
||||||
axios.get("http://localhost:2048/clear")
|
axios.get("http://localhost:2048/clear")
|
||||||
.then(response => this.setState({ data: response.data }));
|
.then(response => this.setState({ data: response.data }));
|
||||||
}
|
}
|
||||||
|
|
@ -36,8 +37,8 @@ class Tree extends Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<button type="button" onClick={this.clear}>clear</button>
|
<button type="button" onClick={() => this.clearData()}>clear</button>
|
||||||
<button type="button" onClick={this.loadData}>refresh</button>
|
<button type="button" onClick={() => this.loadData()}>refresh</button>
|
||||||
<div className="view"><h1>Callstack view</h1>
|
<div className="view"><h1>Callstack view</h1>
|
||||||
<div className="treeView">
|
<div className="treeView">
|
||||||
{this.renderChildren(this.state.data)}
|
{this.renderChildren(this.state.data)}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue