Charleskimani
Charleskimani

Reputation: 510

react-router-bootstrap LinkContainer component fails with a TypeError (0 , _reactRouterDom.withRouter) is not a function


I have been using the LinkContainer from the react-router-bootstrap react library for a while but currently it is throwing this error when I import it:

TypeError (0 , _reactRouterDom.withRouter) is not a function

I have my very simple react application in this codesandbox over here

Help me debug this please.

Upvotes: 0

Views: 1601

Answers (1)

Daniel Ludwig
Daniel Ludwig

Reputation: 89

You have to options, either you downgrade your version (to v5.3.0) of react-router-dom so method withRouter will be available again (used by react-router-bootstrap) or you dismiss react-router-bootstrap and use the useNavigate Hook:

const navigate = useNavigate();
...
<Nav.Link onClick={() => navigate('configuration')}>

Upvotes: 1

Related Questions