react-router-bootstrap icon indicating copy to clipboard operation
react-router-bootstrap copied to clipboard

Can't use search params in LinkContainer to prop

Open PaulCordo opened this issue 2 years ago • 1 comments

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

PaulCordo avatar Jun 08 '23 16:06 PaulCordo

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>

BradWells avatar Jul 12 '23 12:07 BradWells