GithubHelp home page GithubHelp logo

frankly034 / redirect-app Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 63 KB

It is part of a tutorial series: `Elegant react router redirect with URL redirection defense`

JavaScript 3.70% HTML 21.73% TypeScript 56.56% CSS 18.02%
context-api custom-hooks higher-order-component hoc provider-pattern react react-context react-router-v6 security-vulnerability url-redirect

redirect-app's Introduction

React Redirect

This is a React app, bootstrapped using Vite. It is part of a tutorial series: Elegant react router redirect with URL redirection defense (See playlist) to illustrate how to design and implement an elegant and low maintenance react redirection using the higher order component (HOC) and provider pattern.

Table of Contents

App Features

  • A simple react application set up with vite and react router dom with a simple layout.
  • Implementing redirection with a higher order component.
  • Passing authentication state to child compnents using provider pattern (react context).
  • Memorize and redirect users to intending page after login. Like in the case of a link shared via email to a specific path requiring login.

Concepts Employed

  • This app demonstrates the use of React concepts like:
    • Routing and templating with react route dom v6
    • App redirection with higher order component (HOC) and provider patterns.
    • Custom hooks
    • React contexts
    • Higher order component (HOC)

Built with

  • HTML5
  • CSS3
  • JavaScript
  • React (Scaffolded with vite)

Mock Designs

See mock design guides for the app below;

  • Email available at http://localhost:8000/email.html with CTA button directed to /account, however login is required to access this route. After login, user is redirected to /account, as earlier intended instead of the default /dashboard. Screenshot 2023-05-08 at 00 18 53

  • Login page. Screenshot 2023-05-08 at 00 19 37

  • Dashboard, account and not found pages. Screenshot 2023-05-08 at 00 20 22 Screenshot 2023-05-08 at 00 20 48

Required Installations

  • Node/NPM

Installation

Once you have installed the required packages, proceed with the following steps

Clone the Repository

your@pc:~$ git clone [email protected]:frankly034/redirect-app.git

Move to the downloaded folder

your@pc:~$ cd redirect-app

Install all packages

your@pc:~$ npm install

Open the app

your@pc:~$ npm run dev

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Acknowledgements

redirect-app's People

Contributors

frankly034 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.