Skip to content

A React application for user authentication and navigation. Perfect for learning React Router, Bootstrap, and useLocalStorage.

Notifications You must be signed in to change notification settings

ArisLooi/login-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Login App

Welcome to the Login App project! This is a React application that demonstrates user authentication and navigation using React Router, Bootstrap, and useLocalStorage.

Features

  • User authentication with email and password
  • Protected routes for authenticated users
  • Navigation bar with conditional rendering based on authentication status
  • Persistent login state using useLocalStorage

Getting Started

Prerequisites

To run this project, you need Node.js and npm installed on your machine.

Installation

  1. Clone the repository:
    git clone https://github.com/ArisLooi/login-app.git
  2. Navigate to the project directory:
    cd login-app
  3. Install the dependencies:
    npm install
    

Usage

  1. Start the development server:
    npm start
  2. Open your browser and navigate to http://localhost:3000.

Project Structure

login-app/ ├── public/ ├── src/ │ ├── assets/ │ ├── components/ │ │ ├── AppNavbar.jsx │ │ ├── RequireAuth.jsx │ ├── pages/ │ │ ├── Home.jsx │ │ ├── Login.jsx │ │ ├── Dashboard.jsx │ │ ├── Profile.jsx │ ├── App.css │ ├── App.jsx │ ├── AuthContext.js │ ├── index.css │ ├── main.jsx ├── .gitignore ├── eslint.config.js ├── index.html ├── package-lock.json ├── package.json ├── README.md └── vite.config.js

Functions

  • login(): Authenticates the user and sets the token in local storage.
  • handleLogout(): Logs out the user by clearing the token from local storage.
  • RequireAuth: A higher-order component that redirects unauthenticated users to the login page.

Contributing

Contributions are welcome! Please fork the repository and create a pull request with your changes.

Acknowledgments

Thanks to all the developers who have contributed to open-source projects and made learning to code accessible to everyone.

Happy coding! 😊

About

A React application for user authentication and navigation. Perfect for learning React Router, Bootstrap, and useLocalStorage.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published