Text Area with [Object object] Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Text Area with [Object object] without wasting too much if your time.

The question is published on by Tutorial Guruji team.

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!

Answer

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>
  );
}
We are here to answer your question about Text Area with [Object object] - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji