Thanks to visit codestin.com
Credit goes to github.com

Skip to content

prohibit && conditional rendering in the return statement of a component #1979

@graingert

Description

@graingert
// avoid
const WrapTingy = ({ cond }) => (
  cond && <Tingy/>
);
 
// that would error if cond is `undefined`, use this version instead:
 
const WrapTingy = ({ cond }) => (
  <>{cond && <Tingy/>}</>
);

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