Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<Router basename="/main"> is not able to match the URL "/" because it does not start with the basename, so the <Router> won't render anything. warning #29

Open
piszczu4 opened this issue Dec 15, 2024 · 0 comments

Comments

@piszczu4
Copy link

piszczu4 commented Dec 15, 2024

I've got error when trying to run it like below:

import { createElectronRouter } from 'electron-router-dom'

export const { Router, registerRoute } = createElectronRouter({
  port: 5123,
  types: {
    /**
     * The ids of the windows of your application, think of these ids as the basenames of the routes
     * this new way will allow your editor's intelisense to help you know which ids are available to use
     * both in the main and renderer process
     */
    ids: ['main'],
  },
})
main.ts

app.on("ready", () => {
	const mainWindow = new BrowserWindow({
		webPreferences: {
			preload: getPreloadPath(),
		},
		frame: true,
	});

	registerRoute({
		id: 'main',
		browserWindow: mainWindow,
		htmlFile: path.join(__dirname, '../../index.html'),
	  })

	  
	});

main.tsx

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
  <React.StrictMode>
    <AppRoutes />
  </React.StrictMode>
);

routes.tsx

import { Router } from "../lib/electron-router-dom";
import { Route } from "react-router-dom";
import App from "./App";
import { Games } from "./pages/games";
import { LoginPage } from "./pages/login";

export function AppRoutes() {
  return (
    <Router
      main={
        <>
          <Route path="/" element={<App />} />
          <Route path="/games" element={<Games />} />
          <Route path="/login" element={<LoginPage />} />
        </>
      }
    />
  );
}




What am I doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant