Skip to content

Setting a prop default to true results in always true even when prop is set to false #177

@hennessyevan

Description

@hennessyevan

I can't really see where in the code but it seems like prop.init's logic is using an || to apply the default where it probably should be a ??

In the reka demo, I set a new prop showTitle and set it to true by default, I then use this to conditionally show the title
image

If I want to set that to false and hide the title, showTitle still evaluates to true
image

I tried to look for where prop.init is being used here but I couldn't find it, I'll keep digging and am happy to contribute a PR for this once I find this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions