enthusiastic-js / form-observer

A simple utility for reacting to events from a form's fields
MIT License
7 stars 0 forks source link

Rename `FormValidityObserver.register` to `configure` #4

Closed ITenthusiasm closed 1 year ago

ITenthusiasm commented 1 year ago

Key Design Decision: Rename FormValidityObserver.register to FormValidityObserver.configure

We're mainly making this note so that the history of this document is not confusing. What was previously referred to as the register method is now the configure method as of today.

We believe that this new name makes much more sense because this method isn't actually registering the field with anything. Instead, it's registering error messages for a given field. But because of existing libraries like React Hook Form and Final Form, some developers may get confused and think that FormValidityObserver.register() is actually necessary to ensure that our library works properly. Thus, we changed the name to something more easily understood: configure. One could say that the method configures the error messages for the specified field. But one can also say that the method is configuring the field itself with the provided error message details. So configure seems to work well here.