Skip to content

react/require-render-return doesn't account for switch statement #543

Closed
@okize

Description

@okize

This example throws error Your render method should have return statement even though an element is being returned.

class Header extends React.Component {
  render() {
    const { text, headerType } = this.props;

    switch (headerType) {
      case 'h1':
        return <h1 className="large-header">{text}</h1>;
      case 'h2':
        return <h2 className="med-header">{text}</h2>;
      default:
        return <h3 className="sm-header">{text}</h3>;
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions