1

Related to this but pertains to Preact Router- Is it possible to use the same component for multiple different routes?

Like <ServiceType path=["/cleaning", "/printing", "/accounting"] />

So that my URL would look like example.com/cleaning example.com/printing example.com/accounting

And they are all handled in the same component <ServiceType />.

Is this possible?

kyw
  • 6,685
  • 8
  • 47
  • 59

1 Answers1

1

according to this it's not possible because it doesn't work with path ranking. the recommendation if you really need Regex Match in path is to switch to enroute or React Router.

Also, Note that this is an open defect from 2017, i wouldn't get much hope its gonna be fixed any time soon..

if you're not into switching lib you will need to do this like so:

<ServiceType path="/cleaning" />
<ServiceType path="/printing" />
<ServiceType path="/accounting" />
Roy.B
  • 2,076
  • 14
  • 23