React Router Match Path issue

Viewed 2198

React router matchPath issue.

I have a url: /users/test?dp=1 and path as /users/:id

When we pass to matchpath of react-router the :id gives test?dp=1. I only want test as the output. I do not want to change the url.

const match = matchPath("/users/test?dp=1", {
  path: "/users/:id",
  exact: true,
  strict: false
});
console.log(match);
1 Answers
Related