mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Use React.PureComponent instead of reimplementing it
This commit is contained in:
parent
04b1678c7f
commit
fd8b36eb1c
@ -20,7 +20,7 @@ import RoomTile from 'matrix-react-sdk/lib/components/views/rooms/RoomTile';
|
|||||||
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
export default class DNDRoomTile extends React.Component {
|
export default class DNDRoomTile extends React.PureComponent {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.getClassName = this.getClassName.bind(this);
|
this.getClassName = this.getClassName.bind(this);
|
||||||
@ -33,17 +33,6 @@ export default class DNDRoomTile extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps, nextState) {
|
|
||||||
// Do a shallow comparison of the props that we pass through (there is no
|
|
||||||
// state to check).
|
|
||||||
// NB: We might want to ignore changes to index in future if reordering
|
|
||||||
// occurs (all indices of all tiles in the sublist will change).
|
|
||||||
if (Object.keys(nextProps).some((k) => nextProps[k] !== this.props[k])) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const props = this.props;
|
const props = this.props;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user