mirror of
https://github.com/bendtherules/buildit-weather-app.git
synced 2026-08-18 13:42:14 +00:00
Rename weather-app to WeatherApp
Also modify App render to data loading conditional rendering parts
This commit is contained in:
@@ -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
@@ -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';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user