Kodie
Kodie
  • Видео 26
  • Просмотров 93 184
How to create Protected Routes and Authentication with React Router V6 2023
Download the code here - github.com/KodieCode/react-private-routes-authentication
In this video, we'll be learning how to create protected routes and authentication with React Router V6. Private routes allow us to control how specific paths are accessible, while authentication provides a secure way to ensure only authorised users can access our content.
By the end of this video, you'll be able to create private routes and authentication in React Router V6, ensuring that your users are protected while they access your content
Using React Router V6 we'll put together an App that has:
1. Authentication wrapper using useContext and useReducer
2. A custom component to build our routes and menu opti...
Просмотров: 70 698

Видео

Unlock Your Earning Potential: Why you need to Start Learning to Code Today!
Просмотров 101Год назад
Are you curious about the world of coding but unsure if it's the right path for you? In this video, we'll explore the top reasons why learning to code can be a game-changer for your personal and professional life. From enhancing problem-solving skills to opening up lucrative career opportunities, coding has a lot to offer. Join us as we dive into the exciting world of programming and discover h...
How to Filter Array of Objects in Javascript - ReactJS Edition
Просмотров 963Год назад
In this video, we'll be learning how to filter an array of objects in JavaScript using the filter function. This function can be used to remove specific items from an array, based on a given condition. If you're looking to learn how to filter an array of objects in JavaScript, then this video is for you! We'll be using the filter function to remove specific items from an array, based on a given...
How to use Dates in JavaScript and React with MomentJS
Просмотров 368Год назад
In this video, we'll learn how to use MomentJS to work with dates in JavaScript. We'll cover how to create, parse, and format dates in both React and JavaScript. If you're interested in learning more about how to use dates in JavaScript, then this video is for you! We'll cover everything from how to create dates to how to parse them into strings. By the end of this video, you'll have the skills...
How to create Private Routes and Authentication with React Router V6
Просмотров 10 тыс.Год назад
NEW VERSION AVAILABLE Due to the feedback received on this video, a new version with a link to download the code is available here: ruclips.net/video/q94v5AhgrW4/видео.html In this video, we'll be learning how to create private routes and authentication with React Router V6. Private routes allow us to control how specific paths are accessible, while authentication provides a secure way to ensur...
How to Iterate through an array in JSX - ReactJS
Просмотров 708Год назад
Many people coming to React from our Javascript struggle to loop through data and render to the DOM. That’s where the map feature comes in. Iterate through data and output to the DOM with or without conditions. #reactjs #arrays #jsx
How to control refreshing your hook data - React JS Hooks
Просмотров 802Год назад
How to control refreshing your hook data - React JS Hooks
Revolutionise Your Code: Unleash the Power of Inline JSX Switch Statements
Просмотров 1,3 тыс.Год назад
Revolutionise Your Code: Unleash the Power of Inline JSX Switch Statements
How to use the useReducer Hook - Better than useState for managing objects, arrays or complex data
Просмотров 881Год назад
How to use the useReducer Hook - Better than useState for managing objects, arrays or complex data
How to create a custom hook in ReactJS - Move your data and logic to reusable components
Просмотров 373Год назад
How to create a custom hook in ReactJS - Move your data and logic to reusable components
How to use the useContext Hook for a truly global state - React JS Tutorial
Просмотров 797Год назад
How to use the useContext Hook for a truly global state - React JS Tutorial
React JS Crash Course for Beginners - E6 - React-Router
Просмотров 122Год назад
React JS Crash Course for Beginners - E6 - React-Router
React JS Crash Course for Beginners - E5 - useEffect
Просмотров 63Год назад
React JS Crash Course for Beginners - E5 - useEffect
React JS Crash Course for Beginners - E4 - State & Forms
Просмотров 114Год назад
React JS Crash Course for Beginners - E4 - State & Forms
React JS Crash Course for Beginners - E3 - Components & Props
Просмотров 94Год назад
React JS Crash Course for Beginners - E3 - Components & Props
React JS Crash Course for Beginners - E2 - JSX & Styles
Просмотров 59Год назад
React JS Crash Course for Beginners - E2 - JSX & Styles
React JS Crash Course for Beginners - E1 - Setup & Installation
Просмотров 118Год назад
React JS Crash Course for Beginners - E1 - Setup & Installation

Комментарии

  • @pending.......................
    @pending....................... 3 дня назад

    same here i was doing a while loop haha I'm a noob

  • @MotherMeek
    @MotherMeek 5 дней назад

    So objects don’t always have to be arrays ?

  • @JasonJamesMoore
    @JasonJamesMoore 14 дней назад

    Is it possible to work things this way using createBrowserRouter. Interested to understand this more, and see if I can use child routes with this kind of setup.

  • @dchudziak
    @dchudziak 16 дней назад

    Isn't this method easy to bypass? User can easily change ahte isAuthenticated state or isPrivate consts. Is it okay to protect client routes like this and just protect private data on the backend?

  • @destinyforeveryone3659
    @destinyforeveryone3659 Месяц назад

    This video was exactly what I needed!! I've been confused with authentication and the bunch of different ways to do it and a video that cuts all the extra stuff and shows you the basics of how it works was perfect. Thanks so much, hope you make more videos was sad to see this was your latest on in a year.

  • @theonlymaster9374
    @theonlymaster9374 Месяц назад

    This is a super useful video!!!, went through it, understood how everything is done, great video!!!

  • @vaibhavdani4470
    @vaibhavdani4470 2 месяца назад

    Gold Gold Goldberg !! Happy to find this channel !!

  • @parvezkhan-tv8ze
    @parvezkhan-tv8ze 2 месяца назад

    you explained it well thank you 👍👍

  • @AIwithChinmay
    @AIwithChinmay 2 месяца назад

    straight and easy to understand thanks for the video.

  • @balajig3306
    @balajig3306 3 месяца назад

    Nice ❤

  • @DanielOscarKantong
    @DanielOscarKantong 3 месяца назад

    thanks for helping me with this vid, one subscribe for you sir

  • @alonsoestevam
    @alonsoestevam 3 месяца назад

    Why are the extension files `.js` instead of `.jsx`?

    • @saarza9991
      @saarza9991 Месяц назад

      Doesn't matter it's a framework

  • @baldtepes
    @baldtepes 4 месяца назад

    How would you type this hook with typescript? im getting the error "No overloa matches this call all over the place. Thanks and great video!

  • @yourlinuxguy
    @yourlinuxguy 5 месяцев назад

    Really nice video, Thankyou.

    • @kodieCode
      @kodieCode 5 месяцев назад

      Glad you liked it!

  • @itsLarryAlright
    @itsLarryAlright 5 месяцев назад

    Please I need a tutorial on how to use localstorage with this

  • @mikez5980
    @mikez5980 5 месяцев назад

    Very helpful :) thank you for that info. I was struggling how send data between 3 different components and that video help me a lot. THX again

    • @kodieCode
      @kodieCode 5 месяцев назад

      You're welcome!

  • @webhybrid809
    @webhybrid809 5 месяцев назад

    can you help me to do same thing in next.js, i have to do with user role based , their tho 2 user role , so how to do in next.js with typescript?

  • @ASOCMARCTKD
    @ASOCMARCTKD 5 месяцев назад

    How can I Implement roles of users?

  • @hankpham4431
    @hankpham4431 5 месяцев назад

    can you make a new video on how not to make user logout whenever the page refresh?

  • @user-gs3gm2ti8d
    @user-gs3gm2ti8d 6 месяцев назад

    yes pls do that user key and session expire thingi we do want it

  • @LestiVanela
    @LestiVanela 6 месяцев назад

    Grwat

  • @samontefrankamirsong.5474
    @samontefrankamirsong.5474 6 месяцев назад

    You deserved more subscribers. You are a good example on what the developers should follow. I haven't followed yours but I created something that is similar and in tsx.

    • @kodieCode
      @kodieCode 6 месяцев назад

      I appreciate that!

  • @johnmarynwanze3713
    @johnmarynwanze3713 6 месяцев назад

    i love it great knowledge been passed here, thanks a lot

    • @kodieCode
      @kodieCode 6 месяцев назад

      My pleasure!

  • @princedikko2472
    @princedikko2472 6 месяцев назад

    im a full stack MERN and really agreed to your suggestions and advice, i also apply for computer science in University but they sent to Mathematics Department, and i try to change my course to computer but they reject my applications, so i decide to continue as a self thought programmer and i find my self being a fullStack Mern and the best programmer among our course mets.... actually in terms of becoming a programmer it almost like wasting of time when learning to code at university

  • @vPopovPHX
    @vPopovPHX 7 месяцев назад

    This video is just pure gold! Straightforward, concise, without any useless information. Amazing!

    • @kodieCode
      @kodieCode 6 месяцев назад

      Glad you enjoyed it!

  • @yinkaenochadedokun467
    @yinkaenochadedokun467 7 месяцев назад

    Great and concise 👍

    • @kodieCode
      @kodieCode 6 месяцев назад

      Glad it was helpful!

  • @dimitrispapakos4020
    @dimitrispapakos4020 7 месяцев назад

    Great code , can I please ask how do we redirect to access denied page if we type in /Account if user is not logged in

    • @user-tb3mm6dl3z
      @user-tb3mm6dl3z Месяц назад

      I'm from Russia, but I hope you understand me :D I suggest trying to work with conditional rendering, For example userisAuth ? <MainLayout/> : navite('./login')

  • @alexandrejunior4775
    @alexandrejunior4775 8 месяцев назад

    It's amazing! thank you very much!

    • @kodieCode
      @kodieCode 7 месяцев назад

      Glad you like it!

  • @siriusmain1763
    @siriusmain1763 8 месяцев назад

    it's not working

    • @kodieCode
      @kodieCode 7 месяцев назад

      What's the issue you're having? I don't think anyone else has had a problem.

  • @investia_tech
    @investia_tech 9 месяцев назад

    Good work!

  • @alexmuiruri502
    @alexmuiruri502 9 месяцев назад

    Hi @kodie, Great content here. However, I'd prefer to show the login page if a user tries to access a private page

    • @kodieCode
      @kodieCode 7 месяцев назад

      This is easy enough to do with creating a default route pointing at the login page. That means any route not created based on their status, will show that page instead.

  • @sohaibelbokhari8319
    @sohaibelbokhari8319 9 месяцев назад

    Thks sir.

    • @kodieCode
      @kodieCode 9 месяцев назад

      You’re welcome

  • @zstudio6127
    @zstudio6127 10 месяцев назад

    thanks you for this tut

    • @kodieCode
      @kodieCode 9 месяцев назад

      Welcome 😊

  • @goffardeveloper2056
    @goffardeveloper2056 10 месяцев назад

    how to add role user sir

    • @kodieCode
      @kodieCode 7 месяцев назад

      You would need to add an additional object against the user to define their role and then load the routes depending on what that role is allowed to access.

  • @yasirtahirkheli74
    @yasirtahirkheli74 10 месяцев назад

    Perfect ....Exactly what I was looking for...Coming from pure javascript, jquery and PHP to React this was bit tricky....for me at least....Thanks for making it simple...

    • @kodieCode
      @kodieCode 9 месяцев назад

      Great to hear!

  • @georgekopadze791
    @georgekopadze791 10 месяцев назад

    Good luck with your channel. Liked your content

    • @kodieCode
      @kodieCode 9 месяцев назад

      I appreciate it!

  • @FreddyF1977
    @FreddyF1977 10 месяцев назад

    Nice, simple, to the point. Thanks!

    • @kodieCode
      @kodieCode 9 месяцев назад

      Glad it helped!

  • @DankoKralski
    @DankoKralski 10 месяцев назад

    Amazing video! I love how there are people like you that go straight to the point and explain in plain English. Thanks a lot for the video! PS: Better teaching methods than my university (will definitely suggest to my friends)!

    • @kodieCode
      @kodieCode 7 месяцев назад

      Really appreciate the feedback!

  • @IXBoyI
    @IXBoyI 11 месяцев назад

    why on refresh it does not hold the private links? It resets and I have to click on "login" again so they pop up

    • @kodieCode
      @kodieCode 11 месяцев назад

      This is because in that tutorial we are not storing that the user is authenticated in the localStorage or a cookie. This means a refresh of the page restarts the state. I am working on a video to expand on this authentication method and show how to start storing user details including if the user is logged in so that a returning user might be automatically authenticated

  • @appstuff6565
    @appstuff6565 11 месяцев назад

    thanks for this kodie!

    • @kodieCode
      @kodieCode 11 месяцев назад

      Our pleasure!

  • @natnaelhailu-com
    @natnaelhailu-com 11 месяцев назад

    Thanks for the helpful tutorial!!!

    • @kodieCode
      @kodieCode 11 месяцев назад

      Glad it was helpful!

  • @ankoh69
    @ankoh69 11 месяцев назад

    rooutah

  • @PeriklesPeriklesoglu
    @PeriklesPeriklesoglu 11 месяцев назад

    thank you

  • @justin9494
    @justin9494 Год назад

    Thank you! The map part is genius

  • @justin9494
    @justin9494 Год назад

    How do we add google auth to this?

    • @kodieCode
      @kodieCode Год назад

      I'm planning to do a video on various third party Auth libraries including Google very soon.

    • @justin9494
      @justin9494 Год назад

      @@kodieCode Thanks!

    • @jacketking8433
      @jacketking8433 5 месяцев назад

      @@kodieCode waiting for the video man!!

  • @techguy766
    @techguy766 Год назад

    it was greate one the challlenging thing that i faced is to convet calenders like gregorian to hijri and jalali

    • @kodieCode
      @kodieCode Год назад

      Wow. Not something I've come up against. How did you get around it?

  • @njordhoder
    @njordhoder Год назад

    This only dynamicly shows the menu items. If a user is not logged in it still can go to the private route by typing it in. There is no redirect.

    • @kodieCode
      @kodieCode Год назад

      The routes are only accessible when logged in as the routes are only defined when authenticated therefore not accessible. If a user not logged in tries to directly access a private route they will be shown the default controller

    • @njordhoder
      @njordhoder Год назад

      Wow never thought of setting it up like that. Makes absolute sense. An aha moment for me. Thanks for the reply.

    • @kodieCode
      @kodieCode Год назад

      No problem. The great thing about an overall Auth controller with useContext is that you can make just about anything easily conditional on the user being logged in.

    • @parker7721
      @parker7721 11 месяцев назад

      But what If the user enters to that route from a different tab, he is logged in but since the state of user logged in is only on the other tab, now he wont have access? @@kodieCode

    • @satishksharma
      @satishksharma 9 месяцев назад

      This is okay but how can we show 404 page and not authenticated user according to condition.

  • @avrahampackouz3974
    @avrahampackouz3974 Год назад

    when discussing features can you add the pitfalls to avoid, for example unnecessary rerenders?

    • @kodieCode
      @kodieCode Год назад

      Thanks for the suggestion

  • @benchracer2171
    @benchracer2171 Год назад

    Could we use .then as a substitute for the nesting?

    • @kodieCode
      @kodieCode 11 месяцев назад

      Not in this case, no.