0
votes

In a react component, I'm trying to incorporate a plain text only contenteditable div, but as we use typescript the contenteditable property can not be a string. So in my .tsx-file when I enter this:

contentEditable={"plaintext-only"}

I get this error:

Types of property 'contentEditable' are incompatible. Type '"plaintext-only"' is not assignable to type 'boolean | undefined'.

How can I make it plain text only?

1

1 Answers

4
votes

You need the check the type of property contentEditable,it only accepts boolean or undefined.

Thats why you are getting the error, you are trying to pass the string value.

You can remove the issue, if you update the type of contentEditable to string instead of boolean