DEV Community

Discussion on: I learned React Hooks and now I'm the happiest dev on the planet! 🌎

Collapse
 
isaachatilima profile image
Isaac Hatilima

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?

Collapse
 
braydentw profile image
Brayden W ⚡️

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.

Collapse
 
hnrq profile image
Henrique Ramos

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".