SolidJSS
SolidJS16mo ago
Angelelz

useLocation and useNavigate in the layout?

I'm getting this stupid "<A> and 'use' router primitives can be only used inside a Route." error when I use those primitives in the Layout.
This is my app.tsx:
export default function App() {
  const event = getRequestEvent();
  const [user, lll] = createResource(() => getJWTUser());
  return (
    <Router
      root={(props) => (
        <Suspense>
          <MainNav>{props.children}</MainNav>
          <ModalAndToast />
        </Suspense>
      )}
    >
      <FileRoutes />
    </Router>
  );
}

And I'm using the A component and useNavigate inside MainNav. Is that not the solid way? What is the solid way? Thanks
Was this page helpful?