'react-router and react-router-dom version mismatch

Uncaught Error: useNavigate() may be used only in the context of a <Router> component.

I got this error even though i used useNavigate() inside of BrowserRouter.

The problem was solved when the version mismatch was resolved.

Before

├─ [email protected]
│  └─ [email protected]
└─ [email protected]

After

├─ [email protected]
└─ [email protected]

Did really this version mismatch cause problem or I miss something?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source