Skip to content

Different behavior of useLocation depends on base property #498

Open
@makzimko

Description

@makzimko

Usign wouter v3 (3.3.5 for now) and watching different behavior of useLocation hook.
Previously I was not using base prop for Router and using useLocation to update search query in URL like that:

const [_, setLocation] = useLocation();
const setCategory = (id: string) => {
  setLocation(`?category=${id}`)
}

So starting from /games page after execute of setCategory('123') I was navigated to /games?category=123.

Now I'm trying to add language into URL using base prop for Router and have different behavior: when using base=en and starting from URL /en/games I navigated to /en?category=123.
Please tell me is it expected behavior or it needs to be fixed somehow?
Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions