Closed fivecar closed 8 months ago
@trajano : just FYI, in case I've done something incorrectly. But this change gets rid of the React warnings, and also maintains Typescript correctness.
@trajano : just FYI, in case I've done something incorrectly. But this change gets rid of the React warnings, and also maintains Typescript correctness.
I'll have to check when I have time, but I use function components almost exclusively and forwardRef
is a bit weird to use and I usually forget how to do it whenever I switch languages so I wrote up this example for myself.
https://github.com/trajano/react-hooks/blob/master/cookbook/hoc/withHoc.tsx
This reverts #31, which began to cause warnings and issues in React Native (because function components can't take a ref).
We then update how we handle the refs in Typescript so that there are no Typescript errors when you use the component. Verified working via example app.