You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generally it's a good idea to let React manage the DOM. This means avoiding stuff like querySelector if you can.
There are two other ways I'd recommend to getting the value of inputs:
Use a submit handler on the form element. The submit event object will contain all the input's values (event.target.elements.inputName.value). As a bonus submit events fire when the user hits "Enter" in an input (which won't work if you're just listening for clicks on the button)
Use a controlled input to keep the value in state. That way you always have the value available as a JS variable in scope.
The text was updated successfully, but these errors were encountered:
week10-AJ/src/components/adduser.js
Line 14 in 4888b86
Generally it's a good idea to let React manage the DOM. This means avoiding stuff like
querySelector
if you can.There are two other ways I'd recommend to getting the value of inputs:
event.target.elements.inputName.value
). As a bonus submit events fire when the user hits "Enter" in an input (which won't work if you're just listening for clicks on the button)The text was updated successfully, but these errors were encountered: