React-router-bootstrap: LinkContainer redirects url but doesn’t rerender


I have a LinkContainer, that when clicked on, replaces the url of the webpage, but doesn’t do anything beyond that. Nothing gets rerendered, the page just stays the same.

Eg;

<LinkContainer to={`/item/4`}><Button>Redirect</Button></LinkContainer>

If I’m on localhost:3000/item/1, it renders item 1 just fine. If I click that button, I’m on localhost:3000/item/4, but the page is still on item 1. It’s not until I refresh does the page get updated to item 4.

Any idea what’s going on?

Thanks

Source: React – Stack Overflow

November 26, 2021
Category : News
Tags: react-bootstrap | react-router | react-router-bootstrap | reactjs

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.