Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use search params in LinkContainer to prop #310

Open
PaulCordo opened this issue Jun 8, 2023 · 1 comment
Open

Can't use search params in LinkContainer to prop #310

PaulCordo opened this issue Jun 8, 2023 · 1 comment

Comments

@PaulCordo
Copy link

Using react-router-bootstrap 0.26.2, react-router-dom 6.8.2 and react-bootstrap 2.7.2

If I had a URLSearchParams to the prop to of LinkContainer I get an error :
Cannot include a '?' character in a manually specified to.pathname field...

If I use a normal <Link> from react-router-dom no problem

@BradWells
Copy link

BradWells commented Jul 12, 2023

I am having this issue, too.
Luckily, I think I found a work-around:

<LinkContainer
    to={{
      pathname: '/url/no/search/params/',
      search: '?mySearchParam=' + searchParamValue,
    }}
  >
  <Button variant={'outline-primary'}>Do something</Button>
</LinkContainer>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants