Invariant failed: Browser history needs a DOM

Hello,
i can’t really solve the following problem:

I fetch a list of articles from my site backend (nodejs) and print it in the react demo app.

The app works correctly from the Web. When I try to start it in Android I get the following error:

Invariant failed: Browser history needs a DOM

I think the problem is here:

import {BrowserRouter, Router, Link, Route, Switch} from 'react-router-dom';
...
<BrowserRouter>
  <Switch>
     <Route path="/detail/:id" component={RouterDetail}/>
     <Route exact={true} path="/home" render={() => content}/>
  </Switch>
</BrowserRouter>

I have read everything on the web about this error but I have not been able to understand the problem. I found a lot about react server side.

But my case is different, i use react only as a frontend.

I also tried the following change, on web works correctly, on android still doesn’t works:

import { Router } from "react-router";
import {Link, Switch, Route} from 'react-router-dom';
import createBrowserHistory from 'history/createBrowserHistory';
...
const history = createBrowserHistory();
...
<Router history={history}>
  <Route path="/detail/:id" component={RouterDetail}/>
  <Route exact={true} path="/home" render={() => props.content}/>
</Router>

I have also created a thread on stackoverflow, but unfortunately I have not received a response.

Help would be appreciated

expo is dying? it is almost impossible to get help in this forum

still waiting for some help if possible.

Hey @silli,

You’re trying to use a web-based library on a mobile Android client. Additionally, your issue revolves around a third-party library that is not part of Expo’s offerings so we don’t provide support for such an issue.

Cheers,
Adam

Hi, thanks for the reply at least.
I wrote here, on stackoverflow, on the github repository, on the expo forum, and now on reactflux. I didn’t get help anywhere.

Could you just suggest me which library should I use?
Thank you