S
SolidJS11mo ago
Abdo

Help with solid-router

So i'm trying to to use solid router options like useNavigate and useIsRouting but i get the error
Error: Make sure your app is wrapped in a <Router />
Error: Make sure your app is wrapped in a <Router />
idk what i'm doing wrong i followed the readme on github here is my index.jsx
/* @refresh reload */
import { render } from 'solid-js/web'

import App from './App'
import "./assets/styles/main.css";

import { Router, Route } from "@solidjs/router";


render(() => (
<Router>
<Route path="/" component={App} />
</Router>
), document.getElementById("app"));
/* @refresh reload */
import { render } from 'solid-js/web'

import App from './App'
import "./assets/styles/main.css";

import { Router, Route } from "@solidjs/router";


render(() => (
<Router>
<Route path="/" component={App} />
</Router>
), document.getElementById("app"));
btw i try to use it in App.jsx
import Navbar from './components/includes/navbar';

import { useNavigate } from '@solidjs/router'
const n = useNavigate()

function App() {
return (
<>
<Navbar />
</>
)
}

export default App
import Navbar from './components/includes/navbar';

import { useNavigate } from '@solidjs/router'
const n = useNavigate()

function App() {
return (
<>
<Navbar />
</>
)
}

export default App
2 Replies
REEEEE
REEEEE11mo ago
You can't useNavigate outside the App
Abdo
AbdoOP11mo ago
damn i forgot about that anyways thanks
Want results from more Discord servers?
Add your server