From eb84d5747aac0de781d64fb9cdbf2da13006d85e Mon Sep 17 00:00:00 2001
From: Florian Dold <florian.dold@gmail.com>
Date: Sun, 13 Nov 2016 10:17:39 +0100
Subject: fix small react issues

---
 pages/tree.tsx | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

(limited to 'pages/tree.tsx')

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")!);
 }
-- 
cgit v1.2.3

