Replies: 2 comments
-
Is it enough just to replace |
Beta Was this translation helpful? Give feedback.
0 replies
-
wondering about the same issue. After some investigation, it appears the source file for those react types[0] treats them nearly identically, going as far as forgetting to update the example usage for ComponentRef lol /**
* Retrieves the type of the 'ref' prop for a given component type or tag name.
*
* @template C The component type.
*
* @example
*
* ```tsx
* type MyComponentRef = React.ElementRef<typeof MyComponent>;
* ```
*
* @example
*
* ```tsx
* type DivRef = React.ElementRef<'div'>;
* ```
*/
type ComponentRef<T extends ElementType> = ComponentPropsWithRef<T> extends RefAttributes<infer Method> ? Method
: never; [0] https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is not a bug but a deprecation of a type from React.
In the Navigation Menu component, we have :
But the type
ElementRef
is deprecated and it should be replaced withComponentRef
Beta Was this translation helpful? Give feedback.
All reactions