Skip to content

Commit

Permalink
Disabled serverside rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhymlore committed Nov 3, 2023
1 parent dbb689c commit 62e9c6c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
11 changes: 11 additions & 0 deletions src/app/components/DynamicMapComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import { BrowserRouter } from 'react-router-dom';
import MapComponent from './MapComponent';

const DynamicMapComponent: React.FC = () => (
<BrowserRouter>
<MapComponent />
</BrowserRouter>
);

export default DynamicMapComponent;
14 changes: 9 additions & 5 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
"use client"
import Head from "next/head";
import Box from '@mui/material/Box';
import MapComponent from '../app/components/MapComponent'
import 'mapbox-gl/dist/mapbox-gl.css';
import { BrowserRouter } from "react-router-dom";
import dynamic from 'next/dynamic';
import React from 'react';
import CircularProgress from '@mui/material/CircularProgress';

const DynamicLoadedMapComponent = dynamic(() => import('./components/DynamicMapComponent'), {
ssr: false,
loading: () => <CircularProgress />
});

function HomePage() {

return (
<>
<BrowserRouter>
<Head>
<link
rel="stylesheet"
Expand All @@ -18,9 +23,8 @@ function HomePage() {
<meta name="viewport" content="initial-scale=1, width=device-width" />
</Head>
<Box height={"100vh"} width={"100vw"}>
<MapComponent/>
<DynamicLoadedMapComponent />
</Box>
</BrowserRouter>
</>
);
}
Expand Down

0 comments on commit 62e9c6c

Please sign in to comment.