Skip to content

Commit

Permalink
#36 Add form and state to location component
Browse files Browse the repository at this point in the history
  • Loading branch information
SandraBergstrom committed Jun 30, 2023
1 parent 90c7fa4 commit 8439ec4
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions src/components/LocationForm.js
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;

0 comments on commit 8439ec4

Please sign in to comment.