Fang Jin
1 min readAug 31, 2020

--

What i want to point out is that Form isn't simply a visual element(s). Most of what we see are `Field` which is entirely `Component`, however what's wiring the form togather are all data communication layter, which is better to be coded as a `Hook`.

Therefore there're two reusable pieces here, resuables fields as well as a resusable form hook. And what they need to agree upon before start is a field message interface, ex. `onChange`.

Based on the above, `Form` shouldn't be coded as a library (especially not a Component), because it's a bit too much, you don't want to reinvent the world. Instead the data communication layer can, either you are using `Redux`, `Hook` or any global variables.

To be honest, the real myth here is `onChange` interface.

--

--

Fang Jin
Fang Jin

Written by Fang Jin

Front-end Engineer, book author of “Designing React Hooks the Right Way” and "Think in Recursion"

No responses yet