mirror of
https://github.com/Raghu-Ch/ReactWeather.git
synced 2026-02-12 19:53:01 -05:00
Initial commit React Weather App
This commit is contained in:
26
app/components/WeatherForm.jsx
Normal file
26
app/components/WeatherForm.jsx
Normal file
@@ -0,0 +1,26 @@
|
||||
var React = require('react');
|
||||
|
||||
var WeatherForm = React.createClass({
|
||||
onFormSubmit: function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var location = this.refs.location.value;
|
||||
|
||||
if (location.length > 0) {
|
||||
this.refs.location.value = '';
|
||||
this.props.onSearch(location);
|
||||
}
|
||||
},
|
||||
render: function () {
|
||||
return (
|
||||
<div>
|
||||
<form onSubmit={this.onFormSubmit}>
|
||||
<input type="text" ref="location"/>
|
||||
<button>Get Weather</button>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = WeatherForm;
|
||||
Reference in New Issue
Block a user