-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#36 Add form and state to location component
- Loading branch information
1 parent
90c7fa4
commit 8439ec4
Showing
1 changed file
with
26 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,31 @@ | ||
import React from 'react'; | ||
import axios from 'axios'; | ||
import React, { useState } from "react"; | ||
import axios from "axios"; | ||
import { Form } from "react-bootstrap"; | ||
|
||
const LocationForm = () => { | ||
|
||
} | ||
const [locationName, setLocationName] = useState(""); | ||
const [countries, setCountries] = useState([]); | ||
const [selectedCountry, setSelectedCountry] = useState(""); | ||
}; | ||
|
||
return ( | ||
<form> | ||
<div> | ||
<label>Name of location:</label> | ||
<input /> | ||
</div> | ||
<div> | ||
<label>Country:</label> | ||
<select> | ||
|
||
</select> | ||
</div> | ||
</form> | ||
) | ||
<form onSubmit={handleSubmit}> | ||
<Form.Group> | ||
<Form.Label htmlFor="locationName">Name of location:</Form.Label> | ||
<input | ||
type="text" | ||
name="name" | ||
value={location} | ||
onChange={handleLocationChange} | ||
/> | ||
</Form.Group> | ||
<Form.Group> | ||
<Form.Label htmlFor="country">Country:</Form.Label> | ||
<Form.Control as="select" onChange={handleCountryChange}> | ||
<option key={country.name} value={country.name}></option> | ||
</Form.Control> | ||
</Form.Group> | ||
</form> | ||
); | ||
|
||
export default LocationForm; | ||
export default LocationForm; |