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

223
Views
Is there a way to pass the OnSelect value of a dropdown inside a component, to App.js

I have a searchbar component that contains my dropdown in question. I am wanting to get the selections from the OnSelect value of the dropdown component and pass them to App.js to be used in the handler below.

App.js handler

 const [value, setValue] = useState("");
const dropdownHandler = (e) => {
  console.log(e);
  setValue(e);
};

Normally I would be able to set the onSelect method, to dropdownHandler directly, if the component was inside of App.js. However, I am unsure of how to do this when the components are modular.

Searchbar.js

 <DropdownButton className="dropdown"
      title="Search Filters"
      id="dropdown-menu"
      // onSelect={dropdownHandler}
    >
      <Dropdown.Item eventKey="ddFirstName">First Name</Dropdown.Item>
      <Dropdown.Item eventKey="ddLastName">Last Name</Dropdown.Item>
      <Dropdown.Item eventKey="ddTitle">Title</Dropdown.Item>
      <Dropdown.Item eventKey="ddPhoneNumber">Phone Number</Dropdown.Item>
      <Dropdown.Item eventKey="ddLocation">Location</Dropdown.Item>
    </DropdownButton>

App.js calling the searchbar component.

  <div className="centered-container">
      <Searchbar
          searchQuery={searchQuery}
          setSearchQuery={setSearchQuery}
        />
      </div>

What is the best way to pass the value from this dropdown back to App.js, so I can use the handler function I have written?

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!