Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

138
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda