Closed JohnForster closed 5 years ago
Have you been able to fix this?
I managed to get the code working by moving <Suspense>
outside the <Router>
like below.
import {Component, h} from 'preact'
import {lazy, Suspense} from 'preact/compat'
import Router from 'preact-router'
const SomeRoute = lazy(() => import('./someRoute'))
export default class App extends Component {
render(props,state) {
return (
<Suspense fallback={<h1>loading...</h1>}>
<Router>
<SomeRoute path='/' message='Hello world'/>
</Router>
</Suspense>
)
}
}
I am trying to get preact-router to work with lazy and suspsense in preact-x but it's throwing the error:
This is my app.tsx file:
Small example project can be found here. Even smaller codesandbox here: https://codesandbox.io/s/keen-mendel-8jm91