1
0
mirror of https://github.com/kremalicious/umami.git synced 2024-12-24 02:06:19 +01:00
umami/hooks/useLocale.js

14 lines
345 B
JavaScript
Raw Normal View History

2020-09-09 05:46:31 +02:00
import { useDispatch, useSelector } from 'react-redux';
import { updateApp } from 'redux/actions/app';
export default function useLocale() {
const locale = useSelector(state => state.app.locale);
const dispatch = useDispatch();
function setLocale(value) {
dispatch(updateApp({ locale: value }));
}
return [locale, setLocale];
}