Andarist / react-textarea-autosize

<textarea /> component for React which grows with content
http://andarist.github.io/react-textarea-autosize/
MIT License
2.22k stars 246 forks source link

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

Open molul opened 1 year ago

molul commented 1 year ago

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.

Andarist commented 1 year ago

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.

molul commented 1 year ago

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.

Andarist commented 1 year ago

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.