Skip to content

Default props for boolean flags #164

Open
@Mohammer5

Description

@Mohammer5

Ok, so the default in the context is not as necessary. All right, yeah I guess there's not really any real harm in having it, other than that there's an implicit default in the Table and an explicit one in the context.

Originally posted by @ismay in dhis2/ui#211 (comment)

I think it would be nice to provide defaultProps for our boolean flags. Right now they're implicitly false as not providing them leaves them undefined.

Providing them increases the coding overhead slightly. But reading the code and its intention is easier, it's type-safe (as we'd not be using undefined but false) and doesn't cause confusion when used together with react's context as that one expects a default value

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions