Skip to content

Gatsby-link : change url query string #2074

@cyrilepinat

Description

@cyrilepinat

Hi,
I'm using navigateTo to change my url search query. I want to stay on the same page, but I want to change the params in url. For example, on click, I call navigateTo(`${location.pathname}${newSearchQuery}`); to go from /resources to /resources?type=webinar.

When my app is built with gatsby build, the url is actually updated but the page isn't rerendered and I can see in the console A page wasn't found for "/resources?type=webinar".

So my question is :
Is it the good way to change a search query in the url ? If no, what's the best way to achieve that ? I didn't found anything about that in the doc.

Thks for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions