Skip to content

Improve code quality in register and mylogin forms #207

@att78

Description

@att78

As Riku explains in his comment below, there is some repetitive code in formulas.

"I saw a lot of repetitiveness like touched.email && errors.email in every form field. I experienced little bit and found out how to make function that return true or false for given field (email, username etc).

type fieldKeys = keyof typeof values
const checkIfTouchedAndErrors = (fieldName: fieldKeys): boolean =>
!!(touched[fieldName] && errors[fieldName])

If you wan't to make this change it can be used like this checkIfTouchedAndErrors('email')"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions