0

My input type text is not submit. thanks you sir

Submit input type text https://code.sololearn.com/WqKy1f2H3jbY/?ref=app

25th Jul 2022, 7:39 PM
Malick Diagne
Malick Diagne - avatar
3 Answers
0
It is but your container is div not form, input submit works inside form, to call onsubmit on form element. So if you need submit replace div with form, also by default it will show new blank page, you may need to preventDefault
25th Jul 2022, 7:59 PM
PanicS
PanicS - avatar
0
I have warning console. I have blank page. What preventDefault may need ? Thanks you https://code.sololearn.com/WqKy1f2H3jbY/?ref=app
25th Jul 2022, 8:30 PM
Malick Diagne
Malick Diagne - avatar
0
In this code you mix js way of doing with react, in react we use state and useEffect for example. So to store input value you need to add onchange to input, so when user type it will be stored as state value, letter by letter. Than when onsubmit heppend you assign this value to paragrapf. Not so easy topic to explain, if you didnt understand me, check some react tutorial, I learned react from free code camp - video on youtube. prevendDefault stop new blank screen from showing and allow you do show value to screen, by default it schoold sebd this data to backend and show new page after, but in this example you dont need this, you can google to learn how to implement this in your react app
25th Jul 2022, 9:16 PM
PanicS
PanicS - avatar