mattermost-mobile/app/hooks/did_update.ts
Mattermost Build a60d3eeb92
MM-34407 Use Avatars for Sidebar DMs (#5334) (#5358)
* MM-34407 Use Avatars for Sidebar DMs

* Update app/components/channel_icon.js

Co-authored-by: Joseph Baylon <joseph.baylon@mattermost.com>

* UI feedback

* Align the private channel icon

Co-authored-by: Joseph Baylon <joseph.baylon@mattermost.com>
(cherry picked from commit 1b36529853)

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2021-04-29 09:18:48 -04:00

18 lines
485 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {useRef, useEffect, EffectCallback, DependencyList} from 'react';
function useDidUpdate(callback: EffectCallback, deps?: DependencyList) {
const hasMount = useRef(false);
useEffect(() => {
if (hasMount.current) {
callback();
} else {
hasMount.current = true;
}
}, deps);
}
export default useDidUpdate;