-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
42 lines (35 loc) 路 871 Bytes
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React, { Component } from "react";
import {
Route,
Router
} from "react-router-dom";
import "./css/App.css";
import Search from "./Search";
import Results from "./Results";
import history from "./history";
class App extends Component {
constructor(props) {
super(props);
this.state = {
weatherData: ""
}
this.updateWeather = this.updateWeather.bind(this);
}
updateWeather(jsonData) {
console.log(jsonData);
this.setState({
weatherData: jsonData
});
}
render() {
return (
<Router history={history}>
<div className="App">
<Route exact path="/" render={(props) => <Search updateWeather={this.updateWeather}/>}/>
<Route path="/results" render={(props) => <Results weatherInfo={this.state.weatherData}/>}/>
</div>
</Router>
);
}
}
export default App;