shlink-web-client/src/index.tsx

31 lines
898 B
TypeScript
Raw Normal View History

2022-04-02 08:50:59 +02:00
import { createRoot } from 'react-dom/client';
2018-06-03 20:12:40 +02:00
import { Provider } from 'react-redux';
2018-06-03 13:15:52 +02:00
import { BrowserRouter } from 'react-router-dom';
import pack from '../package.json';
import { container } from './container';
import { setUpStore } from './container/store';
import { register as registerServiceWorker } from './serviceWorkerRegistration';
import './index.scss';
2018-05-13 08:57:47 +02:00
const store = setUpStore(container);
const { App, ScrollToTop, ErrorHandler, appUpdateAvailable } = container;
2018-06-03 20:12:40 +02:00
2024-10-12 20:06:48 +02:00
createRoot(document.getElementById('root')!).render(
2018-06-03 20:12:40 +02:00
<Provider store={store}>
<BrowserRouter basename={pack.homepage}>
2019-03-04 20:40:26 +01:00
<ErrorHandler>
<ScrollToTop>
<App />
</ScrollToTop>
</ErrorHandler>
2018-06-03 20:12:40 +02:00
</BrowserRouter>
</Provider>,
2018-06-03 13:15:52 +02:00
);
// Learn more about service workers: https://cra.link/PWA
registerServiceWorker({
onUpdate() {
store.dispatch(appUpdateAvailable());
},
});