Rename weather-app to WeatherApp

Also modify App render to data loading conditional rendering parts
This commit is contained in:
2018-03-30 12:19:56 +05:30
parent 30f8217fa3
commit 1715d332aa
6 changed files with 10 additions and 2 deletions
@@ -62,6 +62,14 @@ export class WeatherApp extends React.Component<{}, WeatherDataState> {
}); });
} }
renderLoading(): JSX.Element | string {
return 'Still Loading';
}
renderDates(): JSX.Element | string {
return 'Loading complete';
}
render() { render() {
return ( return (
<div className="App"> <div className="App">
@@ -70,7 +78,7 @@ export class WeatherApp extends React.Component<{}, WeatherDataState> {
<h1 className="App-title">Welcome to React</h1> <h1 className="App-title">Welcome to React</h1>
</header> </header>
{this.state.data !== undefined ? JSON.stringify(this.state.data) : 'Data Loading...'} {this.state.data !== undefined ? this.renderDates() : this.renderLoading()}
</div> </div>
); );
} }

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

+1 -1
View File
@@ -1,6 +1,6 @@
import * as React from 'react'; import * as React from 'react';
import * as ReactDOM from 'react-dom'; import * as ReactDOM from 'react-dom';
import { WeatherApp } from './Components/Weather-App'; import { WeatherApp } from './Components/WeatherApp';
import registerServiceWorker from './registerServiceWorker'; import registerServiceWorker from './registerServiceWorker';
import './index.css'; import './index.css';