degmods.com/src/App.tsx

32 lines
847 B
TypeScript
Raw Normal View History

2024-10-23 18:00:53 +02:00
import { RouterProvider } from 'react-router-dom'
2024-12-26 16:42:11 +01:00
import { useEffect, useMemo } from 'react'
import { routerWithNdkContext as routerWithState } from 'routes'
import { useNDKContext } from 'hooks'
import './styles/styles.css'
2024-07-10 23:31:54 +05:00
function App() {
const ndkContext = useNDKContext()
2024-12-26 16:42:11 +01:00
const router = useMemo(() => routerWithState(ndkContext), [ndkContext])
useEffect(() => {
// Find the element with id 'root'
const rootElement = document.getElementById('root')
if (rootElement) {
// Add the class to the element
rootElement.classList.add('bodyMain')
}
// Cleanup function (optional): Remove the class when the component unmounts
return () => {
if (rootElement) {
rootElement.classList.remove('bodyMain')
}
}
}, [])
2024-12-26 16:42:11 +01:00
return <RouterProvider router={router} />
}
export default App