Welcome to react-auth-kit Discussions! #149
Unanswered
darkmatter18
asked this question in
General
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. |
0 replies
|
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. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
👋 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.
All reactions