I noticed a subtle difference between Preact's useRef declaration and React's — React's useRef type has an overload that allows for the given <T> or null, which is what you'd expect to be viable when you use useRef as directed by passing in null on initialization.
However Preact's type for useRef doesn't account for this, which means it throws a type error immediately when it sees the null you initially passed.
Is this something that was intentionally excluded or was it perhaps an oversight?
Thank you!
I noticed a subtle difference between Preact's
useRefdeclaration and React's — React'suseReftype has an overload that allows for the given<T>ornull, which is what you'd expect to be viable when you useuseRefas directed by passing innullon initialization.However Preact's type for
useRefdoesn't account for this, which means it throws a type error immediately when it sees thenullyou initially passed.Is this something that was intentionally excluded or was it perhaps an oversight?
Thank you!