Consider using preact-iso router (https://github.com/preactjs/preact-iso).
preact-iso
It's a newer router from the same author of the frozen preact-router (https://github.com/preactjs/preact-router/blob/main/README.md)
preact-router