Conversation
rschristian
left a comment
There was a problem hiding this comment.
I took a skim, but this doesn't seem to really be a Preact library, as you're consuming things that look like Preact components (but aren't) into a wrapper.
This isn't a file-based router that'd work for Preact apps, but your own framework. I don't think it's appropriate here
You can check the demo Ufbr takes zikojs file based router which can be customized by a domifier |
This how it works It doesn't transform Preact to Zikojs |
|
Yes, I had checked the demo, but those aren't Preact components being used as they can be async. That's very much not allowed. This page should generally be about tools you can use in a Preact app, not tools that can take Preact-ish components for use elsewhere. |
|
Maybe something is wrong because i misunderstood how Preact works , i will solve it later with other approach |
|
I reimplemented it. I’m no longer using the ZikoJS file-based router itself, only a few shared utilities for route matching and dynamic params (masks, checks, parsers, etc.). With this approach, The new Demo : https://stackblitz.com/edit/zakarialaoui10-ufbr-uggmzzzd?file=src%2Fpages%2Fasync%2Ftodos%2F[id].jsx |

Overview
ufbr is an Universal File Based Router with
PreactsupportsFeatures
Demo
Usage
This setup supports the following routes:
Best practices
Use ufbr with Preact when you need a client-side, file-based router and SEO is not a priority (for example, dashboards or internal tools).
For SSR and SEO-focused, file-based routing, consider using Next.js, Astro, or similar frameworks.
Implementation :
https://github.com/zakarialaoui10/ufbr/blob/main/src/preact/index.js