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

234
Views
I want to select value from react select
const [brand_id, setBrandId] = useState([])

const handleBrand = (e) => {
  setBrandId(e.target.value);
  console.log('hii')
}

below is react select in a component

<SearchableSelect
  label={'Brand'}
  important
  placeholder="Select Brand"
  value={brands}
  options={brand}
  handleChange={(e) => handleBrand(e)}
/>

The error is

Cannot read properties of undefined (reading 'value')

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Most of the react select library return the value object in onChange so, Your handler function should be look like:

const handleBrand=(brand)=>{

    setBrandId(brand.id);
    console.log({brand});
}

and in jsx

handleChange={handleBrand}

Check out the react-select props docs to learn more about Select props

https://react-select.com/props#select-props

search onChange method to explore.

about 4 years ago · Juan Pablo Isaza Report
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!