Created
November 15, 2017 16:40
-
-
Save gmacdougall/1b2ccaab5cdc295d70fc65e72c0425a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var React = require('react'); | |
var WeatherForm = require('WeatherForm'); | |
var WeatherMessage = require('WeatherMessage'); | |
class Weather extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
location: 'Miami', | |
temp: 88 | |
}; | |
} | |
handleSearch(location) { | |
console.log(` this is your location: ${location}`) | |
this.setState({ | |
location: location, | |
temp: 23 | |
}); | |
} | |
render() { | |
var {temp, location} = this.state; | |
return ( | |
<div> | |
<h3>Get Weather</h3> | |
<WeatherForm onSearch={this.handleSearch} /> | |
<WeatherMessage temp={temp} location={location}/> | |
</div> | |
) | |
} | |
} | |
module.exports = Weather; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment