From 328f584d5205e5614a774cd9f4c9f30b32faba94 Mon Sep 17 00:00:00 2001 From: Mohsen Azimi Date: Sat, 27 Feb 2016 18:04:26 -0800 Subject: [PATCH] Use `this` in AppState constructor for updating timer --- src/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index f82c1df..66d9059 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -11,7 +11,7 @@ class AppState { constructor() { setInterval(() => { - appState.timer += 1; + this.timer += 1; }, 1000); } @@ -39,4 +39,4 @@ class TimerView extends React.Component<{appState: AppState}, {}> { }; const appState = new AppState(); -ReactDOM.render(, document.getElementById('root')); \ No newline at end of file +ReactDOM.render(, document.getElementById('root'));