1

I have written the code to make "Read more" functionality in ".tsx" file for my project. The code is:

const ReadMore = ({ children }) => {
    const text = children;
    const [isReadMore, setIsReadMore] = useState(true);
    const toggleReadMore = () => {
      setIsReadMore(!isReadMore);
    };
    return (
      <ResponsiveHeading.P className={classes.lighterFont}>
        {isReadMore ? text.slice(0, 120) : text}
        <span onClick={toggleReadMore} className={classes.readMoreLink}>
          {isReadMore ? 'Read more' : 'Show less'}
        </span>
      </ResponsiveHeading.P>
    );
  };

Now, I am getting this error for the "children" prop in first line of code I showed above.Error is:

Binding element 'children' implicitly has an 'any' type.ts

How do I fix this?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • 1
    Please refer to this link. [How to fix Binding element 'children' implicitly has an 'any' type.ts](https://stackoverflow.com/questions/55370851/how-to-fix-binding-element-children-implicitly-has-an-any-type-ts7031) – Dali Oct 15 '22 at 17:03

0 Answers0