Skip to content

utilizing a ternary operator when null is one side #44

@Michelle-Ward

Description

@Michelle-Ward

https://github.com/ecomm-Labs/catwalk/blob/84bcf1d41f564d28d09670d5f97a5eb3b712c8f7/client/src/components/Questions/QandAHeader.jsx#L98

similar to another issue posted. if one side of the ternary is nothing (null, ''). You can use the && operator to display something if the left side of the comparison is true to display the right side. It has better readability in this case and requires less code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions