-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApplicationForm.js
49 lines (45 loc) · 1.33 KB
/
ApplicationForm.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import React, { useState } from 'react';
function ApplicationForm({ onSubmit }) {
const [formData, setFormData] = useState({
applications: 0,
phoneScreens: 0,
inPersonInterviews: 0,
offers: 0,
});
const handleFormSubmit = (event) => {
event.preventDefault();
const newFormData = {
applications: parseInt(event.target.elements.applications.value),
phoneScreens: parseInt(event.target.elements.phoneScreens.value),
inPersonInterviews: parseInt(event.target.elements.inPersonInterviews.value),
offers: parseInt(event.target.elements.offers.value),
};
setFormData(newFormData);
onSubmit(newFormData);
};
return (
<div>
<h1>Application Form</h1>
<form onSubmit={handleFormSubmit}>
<div>
<label>Applications:</label>
<input type="number" name="applications" />
</div>
<div>
<label>Phone Screens:</label>
<input type="number" name="phoneScreens" />
</div>
<div>
<label>In-Person Interviews:</label>
<input type="number" name="inPersonInterviews" />
</div>
<div>
<label>Offers:</label>
<input type="number" name="offers" />
</div>
<button type="submit">Submit</button>
</form>
</div>
);
}
export default ApplicationForm;