import { PathPrefixContext } from './contexts/PathPrefixContext';
import Router from './Router';
import styles from './App.module.css';
function getBasePath(): string {
const elements = document.getElementsByTagName('base');
if (elements.length !== 1) {
return '/';
}
return new URL(elements[0].href).pathname;
}
function App() {
const basePath = getBasePath();
return (
<PathPrefixContext.Provider value={basePath}>
<div className={styles.app}>
<Router basePath={basePath} />
</div>
</PathPrefixContext.Provider>
);
}
export default App;