You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
memos/web/src/App.tsx

33 lines
836 B
TypeScript

import { useEffect } from "react";
import { useTranslation } from "react-i18next";
import { RouterProvider } from "react-router-dom";
import { globalService, locationService } from "./services";
import { useAppSelector } from "./store";
import router from "./router";
import * as storage from "./helpers/storage";
4 years ago
function App() {
const { i18n } = useTranslation();
const global = useAppSelector((state) => state.global);
4 years ago
useEffect(() => {
locationService.updateStateWithLocation();
window.onpopstate = () => {
locationService.updateStateWithLocation();
};
globalService.initialState();
}, []);
useEffect(() => {
i18n.changeLanguage(global.locale);
storage.set({
locale: global.locale,
});
}, [global.locale]);
return <RouterProvider router={router} />;
4 years ago
}
export default App;