So far when creating a form in React we had the following options:

  1. use Ant Form abstraction
  2. create all methods needed for the context manually
  3. use DynamicForm (which uses Ant Form abstraction as a “JS Array of fields -> Form” + adds common cases of validation)

The main reason (and problem for 2) to use an abstraction to Forms is so we don’t need to recreate methods for each case (e.g: validation, fields touch state, etc).

DynamicForm works pretty well when you have a simple form with no complex inputs, however I do feel I’ve already overused it by adding code so I could cover specific required cases.

As for the Ant Form abstraction the team seems not to like it. I made some tests with it, it didn’t seem very good when I needed to create a custom validation and didn’t handle very well the case I needed to add the Ace Editor as a form field.

Reasons I see for us to create the abstraction:

  • easily create form validations with standard messages
  • customize field types to fit our need

For discussion I’d like to first know what you think about the idea. Then, if you are positive about it, what way would you like it? (or not ~ e.g.: you can mention your main concerns about Ant abstraction).

What about some other React Forms library?

2 Likes