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
constForm=(props)=>{return(<form><inputname='name'/><inputname='job'/><buttontype='button'onClick={()=>{props.addCharacter(// use any preferred approach to reference the value in needdocument.forms[0].elements.name.value,document.forms[0].elements.job.value)}}>
Add
</button></form>)}
Since your source code is drastically different ( it has a bit more lines and it's kind of hard to easily comprehend for me yet), can you point disadvantages of the way I approached it ( if any ) ?
The text was updated successfully, but these errors were encountered:
You should never be referencing document in React. You should always use state and event. Your way of retrieving values may be easier for you to understand right now, but the way outlined in the article is how you will see it done in almost any other React app.
In my App.js I have the method to handle adding a new user (with name and job fields)
And I use the functional Form component :
Since your source code is drastically different ( it has a bit more lines and it's kind of hard to easily comprehend for me yet), can you point disadvantages of the way I approached it ( if any ) ?
The text was updated successfully, but these errors were encountered: