* 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>
18 lines
485 B
TypeScript
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;
|