79502029

Date: 2025-03-11 20:25:55
Score: 1
Natty:
Report link

Found an asnwer:

history package can still be used with react-router v.7 same as in the code in the question via unstable_HistoryRouter as follows:

import { unstable_HistoryRouter as Router, Routes, ... } from "react-router";

Key point is to add history listener before Router adds its listener, otherwise react-router throws an error disallowing more than 1 history listener.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: user2789261