Skip to content

Instantly share code, notes, and snippets.

@gmacdougall
Created November 15, 2017 16:40
Show Gist options
  • Save gmacdougall/1b2ccaab5cdc295d70fc65e72c0425a6 to your computer and use it in GitHub Desktop.
Save gmacdougall/1b2ccaab5cdc295d70fc65e72c0425a6 to your computer and use it in GitHub Desktop.
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