Hi Brayden, is there a way of having less code in your AddCustomer.is? Where you have const onNameChange = e => { setName(e.target.value) } Does that mean you will have to repeat that code structure for however many input fields you have?
No, this function is only for changes to inputs with for the name. I only have one.
Then there is another function for the tag radio buttons.
How's it going, Isaac? I think you can make a custom hook for input fields. This is mentioned in some articles and Dan Abramov also creates one of those on "React Today and Tomorrow and 90% Cleaner React With Hooks".
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Brayden, is there a way of having less code in your AddCustomer.is? Where you have
const onNameChange = e => {
setName(e.target.value)
}
Does that mean you will have to repeat that code structure for however many input fields you have?
No, this function is only for changes to inputs with for the name. I only have one.
Then there is another function for the tag radio buttons.
How's it going, Isaac? I think you can make a custom hook for input fields. This is mentioned in some articles and Dan Abramov also creates one of those on "React Today and Tomorrow and 90% Cleaner React With Hooks".