12 lines
481 B
TypeScript
12 lines
481 B
TypeScript
import { useSelector, shallowEqual } from 'react-redux';
|
|
|
|
import type { StringGetterFunction } from '@/constants/localization';
|
|
|
|
import { getIsLocaleLoaded, getLocaleStringGetter } from '@/state/localizationSelectors';
|
|
|
|
export const useStringGetter = (): StringGetterFunction => {
|
|
const isLocaleLoaded = useSelector(getIsLocaleLoaded);
|
|
const stringGetterFunction = useSelector(getLocaleStringGetter, shallowEqual);
|
|
return isLocaleLoaded ? stringGetterFunction : () => '';
|
|
};
|