0

My code is working fine and the css properties is working normally but whenever I change wrap the code with suspense the page loads and the suspense works but the css properties attached to them aren't working but if I remove the suspense it's working fine...

Does Anybody have an idea of what I'm doing wrong or what I'm not doing.....

import {Suspense, lazy} from "react"

const Page = lazy(()=> import('./Page'))

function App(){
<Suspense fallback={<h1>loading...</h1>}>
  <BrowserRouter>
    <Routes>
      <Route path="/" element={<Page/>}
    </Routes>
  <BrowserRouter/>
</Suspense>
}
Richard
  • 1
  • 2

1 Answers1

0

I was able to solve this issue by importing the correct css file into your component.

For ex: if you're using a css file of a component that is not a parent of your current component then you will have to import the css file into your current component. In case, you are using styles from different component which is not a parent of <Page /> then pls make sure to import but the css files into your <Page /> component.

hope this helps!