Next.js Discord

Discord Forum

Using component for similar login/register page

Unanswered
Richard Evanson posted this in #help-forum
Open in Discord
I have made very similar looking login and register pages only change is that register page requires password twice and have different links to each other at bottom. Haven't done much functionality yet so I wonder maybe I should turn it into some componenet called "form" or something and then change it with input data or just have 2 pages that are written almost same okay because actual backend will differ a lot?

1 Reply

It's likely a personal perference on code patterns. For me, I would separate it into multiple components (inspired by headless UI libraries).
e.g. Input, Form, FormControl rather than putting all these things into a single component. As you may wanna extend the form to add additional fields