Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

88
Views
Lodash debounce do not console logs the searched query

I'm building a react application with a search bar that gets employee name by querying into an SQL database. In order to reduce the number of queries, I want to implement debounce. I see that not even console log is logging the data as expected. Am unable to crack where is the mistake. Please help me out.

Here is my header or nav bar code

import React, { useState } from "react";
import _ from "lodash";
import styles from "./Header.module.css";

const Header = () => {
  const [searchName, setSearchName] = useState("");

  const searchHandler = (e) => {
    setSearchName(e.target.value);
    console.log(searchName);
  };

  const debouncedOnChange = _.debounce(searchHandler, 200);

  return (
    <div className={styles.header}>
      <div className={styles.left}>
        <h1>Let's Connect</h1>
      </div>
      <div className={styles.right}>
        <input
          type="text"
          placeholder="search for an employee"
          onChange={debouncedOnChange}
          value={searchName}
        />
      </div>
    </div>
  );
};

export default Header;
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!