File tree Expand file tree Collapse file tree 1 file changed +25
-11
lines changed Expand file tree Collapse file tree 1 file changed +25
-11
lines changed Original file line number Diff line number Diff line change 11import { useState , React } from "react" ;
22
33const App = ( ) => {
4- const [ Text , setText ] = useState ( "" ) ;
5- const [ FullName , setFullName ] = useState ( "" ) ;
4+ //fullname
5+ const [ FullnameValue , setFullnameValue ] = useState ( "" ) ;
6+ const [ FullNameView , setFullNameView ] = useState ( "" ) ;
67
7- const textEvent = ( fieldValue ) => {
8- setText ( fieldValue . target . value ) ;
8+ //email
9+ const [ EmailValue , setEmailValue ] = useState ( "" ) ;
10+ const [ EmailView , setEmailView ] = useState ( "" ) ;
11+
12+ //fullname fucn
13+ const fullnameFucn = ( fullnameValue ) => {
14+ setFullnameValue ( fullnameValue . target . value ) ;
15+ } ;
16+
17+ //email fucn
18+ const emailFucn = ( emailValue ) => {
19+ setEmailValue ( emailValue . target . value ) ;
920 } ;
1021
22+ //button click fucn
1123 const onSubmit = ( ) => {
12- setFullName ( Text ) ;
24+ setFullNameView ( FullnameValue ) ;
25+ setEmailView ( EmailValue ) ;
1326 } ;
1427
1528 return (
1629 < >
1730 < div className = "container text-center" style = { { paddingTop : "20%" } } >
18- < h1 > Hi, { FullName } </ h1 >
31+ < h1 > Hi, { FullNameView } </ h1 >
32+ < h6 > { EmailView } </ h6 >
1933 < div className = "pt-3 pb-3" >
2034 < input
2135 type = "text"
2236 placeholder = "Full name"
23- onChange = { textEvent }
24- value = { Text }
37+ onChange = { fullnameFucn }
38+ value = { FullnameValue }
2539 />
2640 < br />
2741 < br />
2842 < input
29- type = "text "
43+ type = "email "
3044 placeholder = "Email"
31- onChange = { textEvent }
32- value = { Text }
45+ onChange = { emailFucn }
46+ value = { EmailValue }
3347 />
3448 </ div >
3549 < button
You can’t perform that action at this time.
0 commit comments