Make sure list has mounted before using ref
This commit is contained in:
parent
4482dd33ce
commit
38ed5a367b
File diff suppressed because one or more lines are too long
@ -6,6 +6,7 @@ import UserListItem from './UserListItem';
|
|||||||
|
|
||||||
export default class UserList extends PureComponent {
|
export default class UserList extends PureComponent {
|
||||||
getSnapshotBeforeUpdate(prevProps) {
|
getSnapshotBeforeUpdate(prevProps) {
|
||||||
|
if (this.list.current) {
|
||||||
const { users } = this.props;
|
const { users } = this.props;
|
||||||
|
|
||||||
if (prevProps.users.length !== users.length) {
|
if (prevProps.users.length !== users.length) {
|
||||||
@ -15,6 +16,7 @@ export default class UserList extends PureComponent {
|
|||||||
} else {
|
} else {
|
||||||
this.list.current.forceUpdate();
|
this.list.current.forceUpdate();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user