In react-router-dom v6 the recommended way of creating the routes is by using createbrowserrouter() instead of components. According to the documentation:
This is the recommended router for all React Router web projects. It uses the DOM History API to update the URL and manage the history stack.
It also enables the v6.4 data APIs like loaders, actions, fetchers and more
Unfortunately the BrowserRouter does not support all the features that are available and needs manual rewriting in our project. It would be awesome if you could update the router implementation.