1

Minimal example with my best attempt so far:

interface Props<T> {
  foo: T
}

const Component = React.forwardRef<HTMLDivElement, React.PropsWithChildren<Props<???>>>({ foo, children }, ref) => {
  return (
    <div ref={ref}>
      {foo}
      {children}
    </div>
  );
}

As you can see in this construction, there's no place to declare the type parameter. How can I express this?

MattPutnam
  • 2,927
  • 2
  • 17
  • 23
  • cant you accept the dynamic parameter during assignment? `Component = React.forwardRef` – John Ruddell Dec 16 '20 at 17:54
  • 3
    Does this answer your question? [React with Typescript -- Generics while using React.forwardRef](https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref) – John Ruddell Dec 16 '20 at 17:57

0 Answers0