@@ -10,10 +10,11 @@ export default class App extends Component {
1010 super ( props ) ;
1111
1212 this . state = {
13- name : 'Silvin Pradhan' ,
13+ firstName : 'Silvin' ,
14+ lastName : 'Pradhan' ,
1415 age : '' ,
15- salary : '' ,
16- hobby : 'N/A ' ,
16+ skills : 'N/A ' ,
17+ classification : 'Freshman ' ,
1718 } ;
1819 }
1920
@@ -29,15 +30,15 @@ export default class App extends Component {
2930 console . log ( res ) ;
3031 } ) ;
3132 toast . success ( `Your data has been saved to Google Sheets successfully` ) ;
32- this . setState ( { name : '' , age : '' , salary : '' , hobby : '' } ) ;
33+ this . setState ( { firstName : '' , lastName : '' , age : '' , skills : '' , classification : '' } ) ;
3334 } catch ( err ) {
3435 console . log ( err ) ;
3536 toast . dark ( `Check your internet connection.` ) ;
3637 }
3738 } ;
3839
3940 render ( ) {
40- const { name , age, salary , hobby } = this . state ;
41+ const { firstName , lastName , age, skills , classification } = this . state ;
4142 return (
4243 < >
4344 < ToastContainer
@@ -53,13 +54,24 @@ export default class App extends Component {
5354 < Header as = "h2" > React Google Sheets!</ Header >
5455 < Form className = "form" onSubmit = { this . submitHandler } >
5556 < Form . Field >
56- < label > Name</ label >
57+ < label > First Name</ label >
5758 < input
58- placeholder = "Enter your name"
59+ placeholder = "Enter your first name"
5960 type = "text"
60- name = "name "
61+ name = "firstName "
6162 required
62- value = { name }
63+ value = { firstName }
64+ onChange = { this . changeHandler }
65+ />
66+ </ Form . Field >
67+ < Form . Field >
68+ < label > Last Name</ label >
69+ < input
70+ placeholder = "Enter your last name"
71+ type = "text"
72+ name = "lastName"
73+ required
74+ value = { lastName }
6375 onChange = { this . changeHandler }
6476 />
6577 </ Form . Field >
@@ -69,34 +81,35 @@ export default class App extends Component {
6981 placeholder = "Enter your age"
7082 type = "number"
7183 name = "age"
72- required
7384 value = { age }
85+ required
7486 onChange = { this . changeHandler }
7587 />
7688 </ Form . Field >
7789 < Form . Field >
78- < label > Salary </ label >
90+ < label > Skills </ label >
7991 < input
80- placeholder = "Enter your salary "
81- type = "number "
82- name = "salary "
83- value = { salary }
92+ placeholder = "Enter your Skills "
93+ type = "text "
94+ name = "skills "
95+ value = { skills }
8496 required
8597 onChange = { this . changeHandler }
8698 />
8799 </ Form . Field >
88100 < Form . Field >
89- < label > Hobby </ label >
101+ < label > Classification </ label >
90102 < input
91- placeholder = "Enter your hobby "
103+ placeholder = "Enter your classification "
92104 type = "text"
93- name = "hobby"
94- value = { hobby }
105+ name = "classification"
106+ value = { classification }
107+ required
95108 onChange = { this . changeHandler }
96109 />
97110 </ Form . Field >
98111
99- < Button color = "blue " type = "submit" >
112+ < Button color = "green " type = "submit" >
100113 Submit
101114 </ Button >
102115 </ Form >
0 commit comments