Skip to content

Commit

Permalink
Merge pull request #18933 from emilpaw/remove-class-component-usage
Browse files Browse the repository at this point in the history
Remove class component usage
  • Loading branch information
qmonmert authored Jun 16, 2022
2 parents e8ecdb4 + 99424f5 commit 0c40f8d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import React from 'react';
import { Translate } from 'react-jhipster';
import { Alert } from 'reactstrap';

class ErrorLoading extends React.Component {
render() {
return (
<div>
<Alert color="danger">Error loading component</Alert>
</div>
);
}
}
const ErrorLoading = () => {
return (
<div>
<Alert color="danger">Error loading component</Alert>
</div>
);
};

export default ErrorLoading as React.ComponentType<any>;
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@ import React from 'react';
import { Translate } from 'react-jhipster';
import { Alert } from 'reactstrap';

class PageNotFound extends React.Component {
render() {
return (
<div>
<Alert color="danger">
<Translate contentKey="error.http.404">
The page does not exist.
</Translate>
</Alert>
</div>
);
}
}
const PageNotFound = () => {
return (
<div>
<Alert color="danger">
<Translate contentKey="error.http.404">The page does not exist.</Translate>
</Alert>
</div>
);
};

export default PageNotFound;
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { IconProp } from '@fortawesome/fontawesome-svg-core';

export interface IMenuItem {
children: React.ReactNode;
icon: IconProp;
to: string;
id?: string;
"data-cy"?: string;
children?: React.ReactNode
'data-cy'?: string;
}

export default class MenuItem extends React.Component<IMenuItem> {
const MenuItem = (props: IMenuItem) => {
const { to, icon, id, children } = props;

render() {
const { to, icon, id, children } = this.props;
return (
<DropdownItem tag={Link} to={to} id={id} data-cy={props['data-cy']}>
<FontAwesomeIcon icon={icon} fixedWidth /> {children}
</DropdownItem>
);
};

export default MenuItem;

return (
<DropdownItem tag={Link} to={to} id={id} data-cy={this.props["data-cy"]} >
<FontAwesomeIcon icon={icon} fixedWidth /> {children}
</DropdownItem>
);
}
}

0 comments on commit 0c40f8d

Please sign in to comment.