bradstiff/react-app-location

Can URL params be matched?

Opened this issue · 1 comments

YM-KA commented

Can URL params be matched to a specific route?

I would like something like
export const ManageAccountLocation = new Location('/auth/action')
export const ManageAccountLocationLink = new Location('/auth/action?mode=:mode', {mode: str.required()})

for the below link to generate a unique route separate from /auth/action
http://127.0.0.1:8080/auth/action?mode=resetPassword

I think you could do something like

new Location(
        '/auth/action',
        {},
        {mode: Yup.str.required()}
    )

The second parameter that I left as an empty object is for "route params", and the 3rd one does query (URL) params which I believe is what you want :)

Location.ctor(path: string, pathParamDefs: ?schema, queryStringParamDefs: ?schema): Location