Last active
September 21, 2020 04:37
-
-
Save jinwook-k/680cbf213a62e2b557b3aaec2cc75d1f to your computer and use it in GitHub Desktop.
client/src/Components/WeatherForm.jsx
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
// imports | |
class WeatherForm extends Component { | |
// default state values | |
// componentDidMount() | |
// refreshSaveWeather() | |
// onChange() | |
// saveFormData() | |
// saveToLocalStorage() | |
saveToMongo = (event) => { | |
axios.post("/api/weatherMongo", { | |
zipCode: this.state.zipCodeInput, | |
tempMetric: this.state.tempMetric | |
}).then(response => { | |
let weatherData = response.data; | |
// do whatever you want with the weather data | |
}); | |
} | |
render() { | |
return ( | |
<Form className="weather-form" onSubmit={this.saveToMongo}> | |
... | |
</Form> | |
); | |
} | |
} | |
export default WeatherForm; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment