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

127
Visualizações
Text Area with [Object object]

I created a component for my form, it looks like this

import React from "react";

export default function TextArea(name, value, onChange) {
  return (
    <div className="mt-1">
      <textarea
        rows={3}
        className="mt1 block w-full py-1.5 px-3 rounded-md border-2 border-orange-light"
        placeholder="Digite"
        value={value}
        onChange={onChange}
        name={name}
      />
    </div>
  );
}

But when I use it, it stays in an [object object], inside this textarea

But when I use it, it stays in an [object object], inside this textarea

I'm using it on my form this way

 <TextArea
    name="about"
    value={about}
    onChange={(e) => setAbout(e.target.value)} />

Can anyone tell what I should do to fix this? Thanks!

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

Here is the correct TextArea Component code, please try this and it will resolve your issue :)

import React from "react";

export default function TextArea({ name, value, onChange }) {
  return (
    <div className="mt-1">
      <textarea
        rows={3}
        className="mt1 block w-full py-1.5 px-3 rounded-md border-2 border-orange-light"
        placeholder="Digite"
        value={value}
        onChange={onChange}
        name={name}
      />
    </div>
  );
}

about 4 years ago · Juan Pablo Isaza Relatório

0

First do console.log(value) and find out what is in object , later use it like below with whichever property name your object got.

 value={value.propertyname} 
about 4 years ago · Juan Pablo Isaza Relatório

0

What parameter do you pass to 'value'? Most likely, what is being passed to the 'value' is an object, check that first so I can help you better.

UPDATE

when declaring the about, maybe it's being declared so that it stays as an object. then declare as:

const [about, setAbout] = useState("");
<TextArea
...,
value={about},
...
>
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