Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3: regexparam-based route matching #336

Closed
wants to merge 37 commits into from
Closed

V3: regexparam-based route matching #336

wants to merge 37 commits into from

Conversation

molefrog
Copy link
Owner

@molefrog molefrog commented Sep 13, 2023

Removes default matcher and replaces it with regexparam

Breaking changes

Matching

  • no plus sign modifiers "/:user+"
  • no named wildcards "/:user*"
  • no optional wildcards "/*?" (yet! see Optional wildcards lukeed/regexparam#25)
  • "/users/:id-:name" doesn't work. But, this is supported by path-to-regexp
  • when pattern ends with a trailing slash, it matches both "/home/" and "/home", but I suppose it is a better DX
  • wildcards can only be present at the end of the string, e.g. "/home/:rest*/all" will not work
  • router now accepts parser prop that allows to customize pattern parsing. Now it is easier to integrate with path-to-regexp

Base paths

  • Routes can no longer refer to absolute paths (e.g. ~/home). Why? Because when you are inside a nested context, the content won't be rendered anyway and it requires additional work to support it in regexparam

Modules

  • 'wouter/matcher' has been removed

TODO

  • TypeScript types
  • Type specs for useRoute

@molefrog
Copy link
Owner Author

Wrong branch, closing this.

@molefrog molefrog closed this Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants