A simple React application for generating secure passwords with customizable length and character sets.
This project provides a user-friendly interface to generate strong passwords with varying lengths and character sets. It's built using React and designed to be easy to use and customizable.
- Generate secure passwords with customizable length
- Include or exclude numbers and special characters in generated passwords
- Copy generated passwords to clipboard with a single click
- Simple and intuitive user interface
To run this application locally, follow these steps:
- Clone the repository to your local machine:
git clone https://github.com/Rajkumar562/Password_Generator
- Navigate into the project directory:
cd Password_Generator
- Install dependencies using npm or yarn:
npm install
or
yarn install
- Start the development server:
npm run dev
or
yarn start
- Open your browser and visit
http://localhost:3000to view the application.
- Adjust the password length using the range input.
- Check or uncheck the "Numbers" and "Special Characters" checkboxes to include or exclude them in the generated password.
- The generated password will be displayed in the input field.
- Click the "Copy" button to copy the generated password to the clipboard.
-
useState: It is used to manage various state variables like the length of the generated password, boolean values of numbers and special characters inclusion in the password generation, and the actual generated password.
-
useEffect: This hook is used to trigger the password generation function whenever any of the dependencies (password length, inclusion of numbers, inclusion of special characters) change. This ensures that the generated password is always up to date.
-
useCallback: The useCallback hook is used to memoize the password generation function and the copy password function. By memoizing these functions with appropriate dependencies, unnecessary re-renders are prevented, optimizing performance.
-
useRef: This hook creates a reference to a DOM element, which is used to reference the input field where the generated password is displayed. This reference is then utilized in the copy password function to select and copy the password to the clipboard without causing re-renders.