Protected routes in REACT | Authentication in REACT JS #reactjs

preview_player
Показать описание
Get All Notes, PYQ's, Solved Subjectives, Solved MCQ's, Syllabus Of Each University,

Access All Source Code From GitSchool And Follow For More👇:

Get Categorised Video Lectures On SchoolTube (Free From Distraction)👇:

Official School4U Instagram Handler👇:

Join Our WhatsApp Group 👇:

#school4u #school4you #schoolforyou #schoolforu #education #programming #coding #codingschool #codingschool4u #coding_school4u #codingschoolforyou
Рекомендации по теме
Комментарии
Автор

It was a nice explanation but don't you think it can be done in a better was as well?

Reason - if I have more number of routes it will become a tedious task to add all the elements inside that wrapper and eventually will be having a lot of common code which we can avoid.

Better solution - we can create a single file for both protected and public routes and from there we can map the routes element along with the element and put the condition once in the App file and render all the route inside it!

karmanshuswami
Автор

Waoo super explanation sir in short span of time.

jagdishjena
Автор

Set isAithenticated in dependency array in useEffect it's good practice

iwillchangemybadtime
Автор

You can avoid using useEffect by using the Navigate component and directly checking the isAuthenticated in jsx

sultanmuhammad
Автор

Backend se bhi routes protected rakhna chahiye. 🤔

Yagnik_Sojitra
Автор

In morning i write this via Ai and now in night i see this😅

princesharma
Автор

shouldn't you use specific middleware for it?

MeanScreenMK-ttcb
Автор

Thank you very much and what is the name of the theme?

Afaqplanetscale
Автор

Maybe this script is editable in browser so it's better to implement this on server side

Aakash_XT
Автор

Using switch cases instead of routing also solves the problem

random_shorts-vb
Автор

Bhai Mai bhi coding kr rha hu, c/c++ html css js sikh liye to aage kya karna chiye mujhe, or is line me aage future hai kuch, and aap kya kar rhe ho study ya job?

Vishal.yeijjs
Автор

nice explanation but
sirf true aur false likhne se kaise check kar sakte hai
I mean wo to hard coded ho gya na
agar user login bhi karega to kaise hoga code ko change karna padega kya ?

NiteshMaurya
Автор

Do you have any videos on how to make login and logout functionality? And related to that ? I need to learn that pls reply

thatguytime
Автор

So now tell me how isAuthenticated variable which condition based true?

safayetthesavage
Автор

Can we hide these routes. Like user don't see the pages name. Or some random text in routes.

muhammadtalhasaeed
Автор

you can do it in a much better way by using Navigate and Outle from react router

rohitbit
Автор

Refresh pe page flash karge . Not a good way

Shyam_Mahanta
Автор

Bhai editing kis video se krte h ye face k sath soot

misterwebhub
Автор

Bro mujhe css mein most use hone wali sabhi property btao mtlv css kitni learn krni Chahiye

batch
Автор

Bhai this is easy. Give examples of sso and api calling with authorisation token like Bearer token for every api call. also give examples of session and cache and refresh token system

mr_shadow_ImPe