Electron - Using reach router for Electron app

less than 1 minute read

Creating a history with a memorySource will allow to work for Electron application with reach/router

1
2
3
4
5
6
7
8
9
10
11
12
import { Router, createMemorySource, createHistory, LocationProvider } from "@reach/router"
let source = createMemorySource("/")
let history = createHistory(source)
const App = () => {
   return (
      <LocationProvider history={history}>
           <Router>
           ....
           </Router>
      </LocationProvider>
   )
}

Categories:

Updated: