diaREact/resources/js/components/pages/AppWrapper.tsx

28 lines
773 B
TypeScript
Raw Permalink Normal View History

import * as React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter as Router} from "react-router-dom";
import App from "./App";
import BasicMenu from "../user/BasicMenu";
import MobileMenu from "../user/MobileMenu";
const app = document.getElementById('app');
const menu = document.getElementById("menu");
const mobileMenu = document.getElementById("mobile-menu");
if (menu) {
ReactDOM.render(<BasicMenu nickname={menu.getAttribute("data-user")} />, menu);
}
if (mobileMenu) {
ReactDOM.render(<MobileMenu nickname={mobileMenu.getAttribute("data-user")} />, mobileMenu);
}
if (app) {
ReactDOM.render(<AppWrapper/>, app);
}
export default function AppWrapper() {
return (
<Router>
<App />
</Router>
)
}