Skip to content

[Feature ✨]: Support tagged template literals for multiple paths #127

Open

Description

@N0tExisting

With the introduction of having multiple paths for one route, it might be useful to have a way to have an option in an arbitrary place in a path eg. using tagged template literals like so:

<Route path={path`example/${["foo", "bar"]}/thing?`} element={<Example/>} />

Activity

  1. orenelbaum commented on Dec 7, 2022

    @orenelbaum
    Contributor

    Maybe it would make more sense to use some special pattern for this?
    Maybe '/example/(foo|bar)/thing?'.
    Another option:
    <Route path="/example/:name/thing?" allowedParams={{ name: ['foo', 'bar'] }} />

  2. JorrenH commented on Jan 20, 2023

    @JorrenH
    Contributor

    @orenelbaum your last suggestion is now possible with #227 using the following:

    <Route path="/example/:fooBar/thing?" matchFilters={{ fooBar: ['foo', 'bar'] }} element={<Example/>} />
  3. fabiospampinato commented on Mar 12, 2023

    @fabiospampinato

    Maybe '/example/(foo|bar)/thing?'.

    /example/(foo|bar)/thing? would be a valid Express path by the way, if the router switched to that this would work out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions