File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -7,15 +7,15 @@ interface Props extends React.HTMLAttributes<HTMLElement> {
7
7
onClickAway : ( event : MouseEvent | TouchEvent ) => void ;
8
8
mouseEvent ?: MouseEvents ;
9
9
touchEvent ?: TouchEvents ;
10
- Container ?: React . ElementType ;
10
+ as ?: React . ElementType ;
11
11
}
12
12
13
13
const ClickAwayListener : FunctionComponent < Props > = ( {
14
14
onClickAway,
15
15
mouseEvent = 'click' ,
16
16
touchEvent = 'touchend' ,
17
17
children,
18
- Container = 'div' ,
18
+ as = 'div' ,
19
19
...props
20
20
} ) => {
21
21
let node = useRef < HTMLElement > ( null ) ;
@@ -38,11 +38,7 @@ const ClickAwayListener: FunctionComponent<Props> = ({
38
38
} ;
39
39
} , [ mouseEvent , onClickAway , touchEvent ] ) ;
40
40
41
- return (
42
- < Container ref = { node } { ...props } >
43
- { children }
44
- </ Container >
45
- ) ;
41
+ return React . createElement ( as , { ref : node , ...props } , children ) ;
46
42
} ;
47
43
48
44
export default ClickAwayListener ;
You can’t perform that action at this time.
0 commit comments