forwardRef

共找到 1 篇文章

1 篇文章
1 分钟阅读
1500 字数
react

forwardRef 定义的组件添加静态属性

forwardRef 定义的组件添加静态属性 🔗 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 import React, { ReactNode, RefAttributes, ForwardRefExoticComponent } from 'react'; interface ModalProps { title: ReactNode; } interface ModalStaticProps { show(): void; hide(): void; } const STATIC_PROPS: