
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-input-debounce
Advanced tools
react input debounce provides a simple and efficient React component to debounce the onChange event of a standard HTML input element. This prevents excessive re-renders or API calls while a user is actively typing, improving performance and user experience.
import { DebounceInput } from 'react-input-debounce';
...
<DebounceInput debounceTimeout={500} onChange={...} />
onChange Event: Automatically debounces the onChange event of an input field, triggering your handler only after a specified delay.debounceTimeout prop.<input> attributes and props.Install the package using npm or yarn:
npm install react-input-debounce
# or
yarn add react-input-debounce
Integrate DebounceInput into your React components just like a regular <input> element. Provide an onChange handler and an optional debounceTimeout (defaults to 100ms).
import React, { ChangeEvent, useState } from 'react';
import { DebounceInput, DebounceInputProps } from 'react-input-debounce';
function MyDebouncedForm() {
const [searchValue, setSearchValue] = useState('');
const [debouncedSearchValue, setDebouncedSearchValue] = useState('');
const [timeout, setTimeout] = useState(500);
// This handler receives the *debounced* change event
const handleDebouncedChange = (event: ChangeEvent<HTMLInputElement>) => {
console.log('Debounced value:', event.target.value);
setDebouncedSearchValue(event.target.value);
// You would typically perform an API call or expensive operation here
};
// This handler receives the *immediate* change event for display purposes
const handleImmediateChange = (event: ChangeEvent<HTMLInputElement>) => {
setSearchValue(event.target.value);
};
return (
<div>
<h1>Search with Debounce</h1>
<div>
<label htmlFor="debounce-timeout">Debounce Timeout (ms): </label>
<input
id="debounce-timeout"
type="number"
value={timeout}
onChange={(e) => setTimeout(Number(e.target.value))}
style={{ marginBottom: '15px' }}
/>
</div>
<label htmlFor="search-input">Search Term:</label>
<DebounceInput
id="search-input"
type="text"
placeholder="Type to search..."
debounceTimeout={timeout} // Dynamic timeout example
onChange={handleDebouncedChange}
// All other standard input props are passed through
className="my-custom-input"
style={{ width: '300px', padding: '8px' }}
/>
<p>Immediate input value: **{searchValue}**</p>
<p>Debounced search value: **{debouncedSearchValue}**</p>
</div>
);
}
export default MyDebouncedForm;
The DebounceInput component accepts all standard InputHTMLAttributes<HTMLInputElement> in addition to the following specific prop:
| Prop | Type | Default | Description |
|---|---|---|---|
debounceTimeout | number | 100 | The delay in milliseconds before the onChange event is fired. |
Contributions are welcome! Feel free to open issues or pull requests on the GitHub repository.
This project is licensed under the MIT License. See the LICENSE file for details.
FAQs
A React component to debounce input onChange event
We found that react-input-debounce demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.