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

136
Views
how to replace this v-model pattern in react hooks

Migrating my vue application into react. In vue 2, using a v-model on a component was an equivalent of passing a value prop and emitting an input event.

If we wanted to change prop or event names to something different, we would need to add a model option to ChildComponent component.

Here is my vue child component:

export default {
      model: {
        prop: 'checked',
        event: 'change'
      },
      props: {
        value: String,
        checked: {
             type: [Boolean, String, Array],
        },
      }
    }

In Parent component i am using like this.

<ChildComponent :checked="SelectedFiles" />

I want to know how to handle this pattern in react hooks. I am not that much familiar with react. Any guidance will be helpful for me.

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

0

You could use useState react hook.

For example:

export const MyComponent = () => {
    const [value, setValue] = useState('');
    return (
        <input
            type="text"
            value={value}
            className="form-control"
            placeholder="Search..."
            onChange={(event) => setValue(event.target.value)}
        />
    );
};
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!