Andarist / react-textarea-autosize

<textarea /> component for React which grows with content

Home Page:http://andarist.github.io/react-textarea-autosize/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Always getting this warning: Invalid DOM property `class`. Did you mean `className`?

molul opened this issue · comments

commented

This is the code I'm using:

<TextareaAutosize
rows={4}
minRows={4}
class="rounded p-2 bg-stone-700 resize-none border-transparent focus:border-transparent focus:ring-0" {...field} {...props} />

This works perfectly. I can set the colors as I want. However, I'm being told to use className, but if I change class to className on my code, the textarea looses all tailwind styling.

Please always try to share a repro case in a runnable form - either by providing a git repository to clone or a codesandbox. OSS maintainers usually can't afford the time to set up the repro, even if exact steps are given.

commented

Please always try to share a repro case in a runnable form - either by providing a git repository to clone or a codesandbox. OSS maintainers usually can't afford the time to set up the repro, even if exact steps are given.

You are right, but my repo is private and I thought this was a very simple issue to check.

I'll try to prepare a repo to show this problem, but I was expecting more something like "oh yes, we're using class and it should be className".

It's weird that tailwind classes are working when using class and not className. Seems like a small slip.

I have no Tailwind experience - but React accepts className and not class. So definitely something is off there but it's unlikely that something is wrong with react-textarea-autosize.