17 lines
496 B
TypeScript
17 lines
496 B
TypeScript
|
// Copyright 2021 Signal Messenger, LLC
|
||
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||
|
|
||
|
import { createSelector } from 'reselect';
|
||
|
import { useSelector } from 'react-redux';
|
||
|
|
||
|
import { StateType } from '../reducer';
|
||
|
import { isShortName } from '../../components/emoji/lib';
|
||
|
|
||
|
export const selectRecentEmojis = createSelector(
|
||
|
({ emojis }: StateType) => emojis.recents,
|
||
|
recents => recents.filter(isShortName)
|
||
|
);
|
||
|
|
||
|
export const useRecentEmojis = (): Array<string> =>
|
||
|
useSelector(selectRecentEmojis);
|