3 ms·
I like the idea, but I still find that I'll need to write a lot of code for the forms. Here is the example for a text field. Is there a way to reduce this?
by jordiburgos 4y ago
I like the idea, but I still find that I'll need to write a lot of code for the forms.
Here is the example for a text field. Is there a way to reduce this?
<TextField
{...register("title", { required: "Title is required" })}
error={!!errors?.title}
helperText={errors.title?.message}
margin="normal"
required
fullWidth
id="title"
label="Title"
name="title"
defaultValue={" "}
autoFocus
/>
- necatiozmen 4y agoWe're working on reducing the boilerplate codes and repeated ones. In the example, there are styling props (from material ui) and there are props required by react-hook-form to work. In the current way, we find it easier to adapt and use. We don't want to introduce a "compact" way to handle form inputs which may look smaller but harder to maintain and also introduces a new API to learn. Still, we're trying our best to reduce boilerplate codes and there's always a room for improvement