Languages

Preact - how to display error page when path is incorrect.

7 points
Asked by:
Frida-Timms
667

As in the question. How to display error on incorrect path?

1 answer
6 points
Answered by:
Frida-Timms
667

I think, this article answers for your question.

Use path="/" and default={true} props with error page in <Router>.

Example: 

<Router>
    <Page1Component path="/page-1" />
    <Page2Component path="/page-2" />
    <Page3Component path="/page-3" />

    <ErrorPageComponent default={true} />
</Router>

 

References

  1. Preact - preact-router default routing

0 comments Add comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join