DEV Community

Discussion on: React JS Web Site Example (Almost like real life).

Collapse
 
svinci profile image
Sebastian G. Vinci

The recommended way is to use event handlers.

Having a function defined as function onChange(event), and passing it to the element as onChange={onChange}.

The thing here is that I didn't want to make it more complex, because it's just one input and one button, so that did the trick. If there were more elements involved, with a more complex form, I would've handled it using event handlers.

You gave me an idea, I'll try to write a post on how to handle complex forms during this week!

Thanks for pointing that out!
Regards.