Moved propTypes and defaultProps as static properties in class components

This commit is contained in:
Alejandro Celaya
2018-08-27 16:53:09 +02:00
parent 47e6e1ca1f
commit 0b089e24de
18 changed files with 168 additions and 209 deletions

View File

@@ -20,18 +20,18 @@ const SORTABLE_FIELDS = {
visits: 'Visits',
};
const propTypes = {
listShortUrls: PropTypes.func,
shortUrlsListParams: shortUrlsListParamsType,
match: PropTypes.object,
location: PropTypes.object,
loading: PropTypes.bool,
error: PropTypes.bool,
shortUrlsList: PropTypes.arrayOf(shortUrlType),
selectedServer: serverType,
};
export class ShortUrlsListComponent extends React.Component {
static propTypes = {
listShortUrls: PropTypes.func,
shortUrlsListParams: shortUrlsListParamsType,
match: PropTypes.object,
location: PropTypes.object,
loading: PropTypes.bool,
error: PropTypes.bool,
shortUrlsList: PropTypes.arrayOf(shortUrlType),
selectedServer: serverType,
};
refreshList = (extraParams) => {
const { listShortUrls, shortUrlsListParams } = this.props;
@@ -186,8 +186,6 @@ export class ShortUrlsListComponent extends React.Component {
}
}
ShortUrlsListComponent.propTypes = propTypes;
const ShortUrlsList = connect(
pick([ 'selectedServer', 'shortUrlsListParams' ]),
{ listShortUrls }