Forms Are Hard
(Source/Credits: https://dev.to/takeshape/forms-are-hard-1hg0)
TLDR; Need forms in your app? There are many options. Our journey to ShapeForm! Itās no secret t...
TLDR; Need forms in your app? There are many options. Our journey to ShapeForm!
{% youtube iplY8Le1zK0 %}
Itās no secret that forms are hard. They cause a great deal of frustration and confusion for developers. However, the other thing thatās no secret is forms are super important to get right for your particular use case. Forms are so ubiquitous that essentially every framework, from Django to Rails to .NET to React, has its own form implementation. React even lists forms as one of the top 10 concepts to grok in their docs!
There are many libraries for building forms. If you search npm for āformsā youāll get back thousands or results. But how do you know which to use? Should you roll your own? In our journey to find the perfect form library we tried a handful of the top options.
For our forms we needed comprehensive validation, customizable form configuration, and serializability. From redux-form
to @hapi/joi
to both of them together to JSON schemas to react-jsonschema-form
. Each library had their strengths and killer features, but no single option had it all ā¦ so in the end we rolled our own.
ShapeForm builds on everything we learned from using and testing the form libraries previously mentioned. We use ShapeForm extensively in TakeShapeās react web client. Here are the features we find super useful:
šŖ JSON Schema validation - Easily share the same form validation frontend and backend
ā”ļø Fast - Pure components for fast rendering even with large forms
š Redux / Standalone state management - Choose your own adventure
š Custom widgets - Widgets are simply React components
š Form reducers - Useful for async validation, data normalization, the sky's the limit.
šÆāāļø Multi-Part Forms - Multiple form components can edit the same form data. Useful for complex layouts or multi-step forms.
In TakeShapeās web client, nearly everything is a form. This includes our content modeling, content editing, metadata, and login functionality. We have gotten so much use out of ShapeForm that we wanted to give it back to the community. First announced at the 8/20 Reactadephia Meetup this code has been freshly ripped from our React App and open sourced as ShapeForm.
If you like it and it works for you, great! If you donāt or it doesnāt, help us make ShapeForm better - we know youāll think of something we havenāt.
Comments section