this.fetchUsers();
}
- componentWillReceiveProps(nextProps: Props) {
- if (nextProps.location.query.search !== this.props.location.query.search) {
- this.fetchUsers(nextProps);
+ componentDidUpdate(prevProps: Props) {
+ if (prevProps.location.query.search !== this.props.location.query.search) {
+ this.fetchUsers();
}
}
}
});
- fetchUsers = ({ location } = this.props) => {
+ fetchUsers = () => {
+ const { location } = this.props;
this.setState({ loading: true });
searchUsers({ q: parseQuery(location.query).search }).then(({ paging, users }) => {
if (this.mounted) {