diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-11-13 10:17:39 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-11-13 10:17:39 +0100 |
commit | eb84d5747aac0de781d64fb9cdbf2da13006d85e (patch) | |
tree | 387d7711e177d151a185e2a9a870c39cc03926ce /pages/tree.tsx | |
parent | b2128609ac8159a14224deba399144b3400c8c20 (diff) | |
download | wallet-core-eb84d5747aac0de781d64fb9cdbf2da13006d85e.tar.xz |
fix small react issues
Diffstat (limited to 'pages/tree.tsx')
-rw-r--r-- | pages/tree.tsx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/pages/tree.tsx b/pages/tree.tsx index c8a67dac2..6ff15600f 100644 --- a/pages/tree.tsx +++ b/pages/tree.tsx @@ -358,7 +358,7 @@ class ExchangeView extends React.Component<ExchangeProps, void> { } interface ExchangesListState { - exchanges: IExchangeInfo[]; + exchanges?: IExchangeInfo[]; } class ExchangesList extends React.Component<any, ExchangesListState> { @@ -371,8 +371,8 @@ class ExchangesList extends React.Component<any, ExchangesListState> { this.update(); } }); - this.update(); + this.state = {} as any; } async update() { @@ -382,18 +382,19 @@ class ExchangesList extends React.Component<any, ExchangesListState> { } render(): JSX.Element { - if (!this.state.exchanges) { + let exchanges = this.state.exchanges; + if (!exchanges) { return <span>...</span>; } return ( <div className="tree-item"> - Exchanges ({this.state.exchanges.length.toString()}): - {this.state.exchanges.map(e => <ExchangeView exchange={e} />)} + Exchanges ({exchanges.length.toString()}): + {exchanges.map(e => <ExchangeView exchange={e} />)} </div> ); } } export function main() { - ReactDOM.render(<ExchangesList />, document.body); + ReactDOM.render(<ExchangesList />, document.getElementById("container")!); } |