How do you handle your component architecture? Here was my approach on a five-step insurance purc...How do you handle your component architecture? Here was my approach on a five-step insurance purc...
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started
How do you handle your component architecture? Here was my approach on a five-step insurance purchase form.
The form has two paths through it. A person fills in different things than a company does. Someone already logged in skips a step. One path gets a document upload that the other never sees.
The easy version is to build the fields for each step as you get to them. I have done that before. By the second change request you have five sets of nearly identical fields and no way to change one without checking the other four.
So I wrote one input instead. You tell it what kind of thing it is and it does the rest. Three kinds covered the whole form: a fixed list of options, a list that comes from the backend like car makes, and pairs of a value and a label.
Every step is then just a list of which fields it needs. And the decision about who sees what does not sit in the inputs at all. It sits above them, in one place. An input never knows which path the user is on.
The part that told me it was right: the whole thing can be lifted into the insurance back office later without rewriting it, because nothing inside it knows what site it is on.
Post image
Back to feed
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started