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

176
Views
The problem with passing callback functions, writes an error props.me is not a function, I can only show part of the code

There is a parent and a child (component) I want to get the values ​​from the child to the parent, I throw the functions themselves into the component, in the child I wrote the return target of the value from the input

parent

const [m, setM] = useState("")
    const me = (m) => {
        setM(m)
        console.log(m)
    }

    const [dey, setD] = useState("")
    const de = (dey) => {
        setD(dey)
    }

    const [y, setY] = useState("")
    const ye = (y) => {
        setY(y)
    }

its companent connect in jsx

<CustomSelect
    className="flex-1"
    btnClass="inp"
    checkedOpt={dey}
    options={d}
    de={de}
/>
<CustomSelect
    className="flex-1 ms-2 ms-xxl-4"
    btnClass="inp"
    checkedOpt={m}
    options={month}
    me={me}
/>
<CustomSelect
    className="flex-1 ms-2 ms-xxl-4"
    btnClass="inp"
    checkedOpt={y}
    options={years}
    ye={ye}
/>

child

 const handleChange = (e) => {
        props.de(e.target.value);
        props.me(e.target.value);
        props.ye(e.target.value);
    }

jsx

<input
    type="radio"
    name="type"
    value={item}
    checked={(item === props.checkedOpt)}
    onChange={handleChange}
/>
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Since the props.me is not passed to every component, you just have to check if it's passed as function :

 const handleChange = (e) => {
        props.de?.(e.target.value);
        props.me?.(e.target.value);
        props.ye?.(e.target.value);
    }
about 4 years ago · Santiago Trujillo 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!