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

Avoid '/?' with query params? #53

Open
jashworth opened this issue Apr 15, 2020 · 1 comment
Open

Avoid '/?' with query params? #53

jashworth opened this issue Apr 15, 2020 · 1 comment

Comments

@jashworth
Copy link

format(query(t.strict({ foo: t.string })).formatter, { foo: 'foo' }); // /?foo=foo

Is there a convenient way to avoid the leading '/?'

(want to build value for react-router <Link to={{ search: ... }}>)

@StefanoMagrassi
Copy link
Collaborator

@jashworth nope: the leading / is always added in order to have a compliant path and the ? is the URL's spec separator for query parameters

I think that the best way to retrieve the search part is to convert the full path into a URL object, get the value from it and then remove the leading ?

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

No branches or pull requests

2 participants