Welcome to react-auth-kit Discussions! #149
Replies: 2 comments 1 reply
-
Hi Thank you for the good work. I'm very new to react and stuff, I'm having so difficulties understanding how to link and use "RequireAuth" in react router. I went through the examples provided. So in the event if I have many "route", does it mean I put "Required Auth" inside all the "elements"? Any advice or kindly point to other existing detailed examples that I might have missed would be appreciated. |
Beta Was this translation helpful? Give feedback.
-
Only use Required Auth, where you need to add Private Route. const RoutesComponent = () => {
return (
<BrowserRouter>
<Routes>
<Route path={'/'} element={<Home/>}/>
<Route path={'/login' } element={<Login/>}/>
<Route path={'/secure'} element={
<RequireAuth loginPath={'/login'}>
<SecureComponent/>
</RequireAuth>
}/>
</Routes>
</BrowserRouter>
)
} As you can see here, the Hope you understand. If anything else, reply freely. |
Beta Was this translation helpful? Give feedback.
-
👋 Welcome!
We’re using Discussions as a place to connect with other members of our community. We hope that you:
build together 💪.
To get started, comment below with an introduction of yourself and tell us about what you do with this community.
Beta Was this translation helpful? Give feedback.
All reactions