Created
October 17, 2023 17:53
-
-
Save Misaka-0x447f/3ed0b5f00414b6e55fd3a3512fd08ae0 to your computer and use it in GitHub Desktop.
如何处理 forwardedRef 时的泛型。source: https://fettblog.eu/typescript-react-generic-forward-refs/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TL/DR ⬇️ source: https://fettblog.eu/typescript-react-generic-forward-refs/ | |
const ClickableList = React.forwardRef(ClickableListInner) as <T>( | |
props: ClickableListProps<T> & { ref?: React.ForwardedRef<HTMLUListElement> } | |
) => ReturnType<typeof ClickableListInner>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment