Use this in AppState constructor for updating timer

This commit is contained in:
Mohsen Azimi 2016-02-27 18:04:26 -08:00
parent 1256b8e27c
commit 328f584d52

View file

@ -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(<TimerView appState={appState} />, document.getElementById('root'));
ReactDOM.render(<TimerView appState={appState} />, document.getElementById('root'));