gcanti / fp-ts-routing

A type-safe bidirectional routing library for TypeScript

Home Page:https://gcanti.github.io/fp-ts-routing/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Avoid '/?' with query params?

jashworth opened this issue · comments

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: ... }}>)

@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 ?