Skip to content

In this project, debounce is implemented through a searchBar to efficiently handle search queries and optimize the user experience.

Notifications You must be signed in to change notification settings

paula-uxengineer/itacademy-node.js-sprint-2.1

Repository files navigation

Implementing Debounce Functionality with a searchbar

In this project, debounce is implemented through a searchBar to efficiently handle search queries and optimize the user experience.

🔈 How Debounce Works

Debouncing is a technique used to limit the rate at which a function is invoked. It postpones the execution of a function until after a certain delay, ensuring that it is only called once after the specified delay, even if it is triggered multiple times within that period. Debounce Method

Debouncing prevents excessive function calls, particularly in scenarios such as handling user input or event listeners, where rapid firing of events can lead to performance issues or undesired behavior. By delaying the execution of the function until after the user has stopped interacting or the event has settled, debounce ensures a smoother and more controlled execution flow.

🕹 Features

  • Debounce Method: Controls the frequency of function invocation by delaying its execution.
  • Optimized Performance: Prevents excessive function calls, improving efficiency.
  • Error Handling: Throws an error if no matching bike is found with the provided name.

🔧 Integration

To integrate debounce functionality into your TypeScript project:

Import the provided code: Incorporate the BikeInput class and the debounce method into your project.

Utilize the debounce method: Apply the debounce method to functions that require rate-limiting or controlled execution.

Error handling: Ensure proper error handling for scenarios where debounce is applied to critical functions or operations.

To use the searchbar introduce the same element on data.json

🚀 Why Debounce?

Debouncing is a valuable technique in scenarios where you need to handle user input or events that may occur rapidly or frequently. Here are some reasons why debounce is beneficial:

🔍 Characteristics:

  1. Controlled Execution Rate: Debounce allows you to limit the rate at which a function is invoked, preventing it from being called more frequently than necessary.

  2. Delay Handling: It can handle delays between function calls, ensuring that there is a minimum interval between successive invocations.

  3. Simple Implementation: Debounce can be implemented using straightforward logic, making it easy to incorporate into your codebase.

🙆‍♀️ Improving User Experience

Debounce enhances the user experience by preventing unnecessary or excessive function calls, particularly in interactive applications or scenarios where responsiveness is crucial. By controlling the execution rate of functions, debounce ensures a smoother and more predictable user interaction.

❗ Get started

💻 Prerequisites

  • Node.js (version >= 14)
  • npm (version >= 6)
  • Typescript
  • Jest
  • Vite

💾 Installation

  1. To get started, you first need to clone the repository:
git clone [https://github.com/paula-uxengineer/to-do-list.git]
  1. Next, install the project dependencies:
npm install

🏁 How To Start

To start the app in development mode, run the following script:

npm run dev

👾 Scripts

This project comes with several predefined scripts in the package.json file:

test: Runs tests using Jest.

npm run jest

dev: Starts the development app with ts-node-dev and allows debugging

npm run dev

vite: Run the React library with Vite (make sure you are inside the directory of "front-end)

npm run vite

🔧 Dependencies

  • "react": "^18.2.0",
  • "react-dom": "^18.2.0"

🔨 Dev Dependencies

  • "@types/react": "^18.2.55",
  • "@types/react-dom": "^18.2.19",
  • "@typescript-eslint/eslint-plugin": "^6.21.0",
  • "@typescript-eslint/parser": "^6.21.0",
  • "@vitejs/plugin-react": "^4.2.1",
  • "eslint": "^8.56.0",
  • "eslint-plugin-react-hooks": "^4.6.0",
  • "eslint-plugin-react-refresh": "^0.4.5",
  • "typescript": "^5.2.2",
  • "vite": "^5.1.0"
  • "@types/jest": "^29.5.12",
  • "@types/node": "^20.11.16",
  • "jest": "^29.7.0",
  • "ts-jest": "^29.1.2",
  • "typescript": "^5.3.3"

🔓 Contributing

Contributions to this project are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Commit your changes to your branch and submit a pull request.

For bug reports or feature requests, please open an issue on the GitHub repository.

🎓 License

This project is licensed under the MIT License. See the LICENSE file for more information.

About

In this project, debounce is implemented through a searchBar to efficiently handle search queries and optimize the user experience.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published