Anish Neupane
Anish Neupane
SSolidJS
Created by Anish Neupane on 3/2/2024 in #support
solidjs createResource doesn't show error when there was an error i.e 401 Invalid credentials
createResource data.error always false
9 replies
SSolidJS
Created by Anish Neupane on 1/4/2024 in #support
Error while using useNavigate() or <Navigate />
PrivateRoute.tsx import { Route, useNavigate } from '@solidjs/router' import Index from '../pages' const PrivateRoute = () => { const isLoggedIn = !!localStorage.getItem('token') const navigate = useNavigate() if (!isLoggedIn) { navigate('/', { replace: true }) } return <Route path='/' component={Index} /> } export default PrivateRoute App.tsx import { MetaProvider } from '@solidjs/meta' import { Route, Router } from '@solidjs/router' import { Component, lazy } from 'solid-js' import PrivateRoute from './routes' const Login = lazy(() => import('./pages/Login')) const App: Component = () => { return ( <MetaProvider> <Router> <Route children={<PrivateRoute />} /> <Route path='/login' component={Login} /> </Router> </MetaProvider> ) } export default App The error in browser is Uncaught Error: Make sure your app is wrapped in a <Router /> Any Solution
28 replies