Part 2: simplr-forms — declarative forms for React . Core, validation, testing

This is series of posts documenting the development of simplr-forms library.

Originally posted on April 14th.

simplr-forms-core pre-alpha is done

During the week, we worked on simplr-forms-core to have a solid foundation for simplr-forms-dom and simplr-forms-native.

Most of the coding was done by Dovydas and Martynas, with valuable and fast reviews by Giedrius. Feels good to work with such an amazing team.

Also, Aurimas joined our efforts by preparing react-native app for development of simplr-forms-native. Thanks, Aurimas!

We will start working on both dom and native packages soon.

So… What happened during the week?

We can confidently say that we have a solid first appearances of core, which consists of:

  • form-stores-handler - a general manager for all forms data stores
  • form-store - a data store for one particular form
  • base-form - a base component for a form to register to store and provide context for children, register with form-stores-handler, etc.
  • base-field - a base component for field that is aware of the parent form, registers and registers to and from form store, incorporates React lifecycle events, etc.

These 4 pretty much cover the base of the whole library.

Of course, there is more to it.

form-stores-handler and base-form extend ActionEmitter for you to be able to addListener for actions and know when the store is created, updates it's state or even more specific actions, e.g. value or props are updated.

This enables another amazing thing: now we can externalize validation!

Shout-out to Giedrius for publishing ActionEmitter right on time and us all for debugging it in a single day 😄

Externalized validation

We understand that most developers use whatever they get out-of-the-box, especially if what they get is an easy-to-consume and also an optimal solution.

But sometimes usage of project-specific validation library is a must.

For example, there are quite a few industries with very specific data structures and their validations. Medicine, aviation, insurance, finance… And that’s just a few on the tip of the tongue.

Therefore, externalizing validation is an amazing step forward to using simplr-forms no matter what data validation requirements you have.

Testing

A library without tests these days is a scary and unstable bomb with a timer that shows gibberish on it’s timer, i.e. you don’t know when it is gonna hit you.

Therefore, we already have 44 tests in 4 test suites.

And we will write as much more as we need to ensure everything will progress forward and this library becomes de-facto a standard, a no brainer when anyone thinks about React and forms.

What’s next?

Releasing pre-alpha of simplr-forms-core and starting development of simplr-forms-dom and (maybe) simplr-forms-native.

Also, simplr-validation is coming into the light as we evaluate all of the peaces for it.

And now… It’s coding time again! 🎉

Next in series

Part 3: First e2e flow, FormStore.ToObject()