0

I have this component:

const TableWrapper = <T extends {}>
  ({
    fields,
    values,
    items,
    limit, 
    currentPage, 
    keyword, 
    showIndex, 
    className, 
    ref 
  }: TableWrapperProps<T>): JSX.Element => {

  // ...

}

export default React.forwardRef(TableWrapper) // Problem

And I need to export it with forwardRef, but I'm getting the following error:

Expected 0 type arguments, but got 1.  TS2558

    122 |       {/* Table Wrapper */}
    123 |       { !isValidating ? (
  > 124 |         <TableWrapper<T>
        |                       ^
    125 |           className={className}
    126 |           fields={fields}
    127 |           values={values}

I need to receive a ref from the parent.

How can I solve this?

Diego Ulloa
  • 500
  • 8
  • 19
  • 1
    Does this answer your question? [Using React forwardRef with Typescript generic JSX arguments](https://stackoverflow.com/questions/51884498/using-react-forwardref-with-typescript-generic-jsx-arguments) – lawrence-witt Jul 28 '21 at 00:13
  • I saw it but I didn't dig it – Diego Ulloa Jul 28 '21 at 03:11
  • How about this one? [React with Typescript — Generics while using React.forwardRef](https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref/58473012) – lawrence-witt Jul 29 '21 at 12:45

0 Answers0